From: Charles Oliver Nutter Date: 2011-02-11T00:09:32+09:00 Subject: [ruby-core:35188] Re: [Ruby 1.9-Bug#4386][Feedback] encoding: directive does not affect regex expressions On Wed, Feb 9, 2011 at 6:47 PM, Usaku NAKAMURA wrote: > IMHO, the US-ASCII fallback of regexp literals is a spec bug of ruby. > The encoding of regexp literals should be the same as script encoding, like string literals. I found it unusual until we started digging into regexp parsing logic for JRuby. As far as I can tell, the change to US-ASCII is a very explicit decision, to allow the widest-possible functionality for a regexp that only needs to match 7-bit ASCII text. Limiting it to only the encoding specified for the file would mean ASCII-only regexps could not (necessarily) be used to match a variety of other encodings, even though logically they'd match just fine. - Charlie