Issue #12034 has been updated by Yui NARUSE. Tracker changed from Bug to Feature This is considered as a spec now. Anyway the change is very tiny. ```c diff --git a/re.c b/re.c index 3f7d227..3619711 100644 --- a/re.c +++ b/re.c @@ -2558,9 +2558,6 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc, enc = fixed_enc; } } - else if (!(options & ARG_ENCODING_FIXED)) { - enc = rb_usascii_encoding(); - } rb_enc_associate((VALUE)re, enc); if ((options & ARG_ENCODING_FIXED) || fixed_enc) { ``` ---------------------------------------- Feature #12034: RegExp does not respect file encoding directive https://bugs.ruby-lang.org/issues/12034#change-56836 * Author: Vit Ondruch * Status: Open * Priority: Normal * Assignee: ---------------------------------------- ~~~ $ 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 -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>