Project

General

Profile

Feature #12034

RegExp does not respect file encoding directive

Added by vo.x (Vit Ondruch) over 4 years ago. Updated over 4 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:73582]

Description

$ cat regexp-encoding.rb
# -*- encoding: binary -*-
puts ''.encoding
puts //.encoding

$ ruby regexp-encoding.rb 
ASCII-8BIT
US-ASCII

The RegExp should have ASCII-8BIT encoding IMO.

Actually there is something different how Ruby 2.3 behaves with regards to encoding, since I cannot compile raindrops gem with Ruby 2.3 anymore due to this test error:

 1) Error:
TestLinux#test_unix_resolves_symlinks:
RegexpError: /.../n has a non escaped non ASCII character in non ASCII-8BIT script
    /builddir/build/BUILD/rubygem-raindrops-0.13.0/usr/share/gems/gems/raindrops-0.13.0/lib/raindrops/linux.rb:57:in `unix_listener_stats'
    /builddir/build/BUILD/rubygem-raindrops-0.13.0/usr/share/gems/gems/raindrops-0.13.0/test/test_linux.rb:97:in `test_unix_resolves_symlinks'

This is the line where it fails:

http://bogomips.org/raindrops.git/tree/lib/raindrops/linux.rb#n57


Files

0001-string.c-rb_external_str_with_enc-fall-back-to-ASCII.patch (1.47 KB) 0001-string.c-rb_external_str_with_enc-fall-back-to-ASCII.patch rebased nobu (Nobuyoshi Nakada), 02/09/2016 04:30 AM
0002-follow-up-for-OS-X.patch (1.52 KB) 0002-follow-up-for-OS-X.patch fix failures on OS X nobu (Nobuyoshi Nakada), 02/09/2016 04:31 AM

Also available in: Atom PDF