Issue #172 has been reported by Dave Thomas.

----------------------------------------
Bug #172: Regular expressions should inherit encoding of context even if they only contain 7-bit chars
http://redmine.ruby-lang.org/issues/show/172

Author: Dave Thomas
Status: Open
Priority: Normal
Assigned to: 
Category: 
Target version: 


The following program fails:

  # encoding: utf-8
  "???y/???x = 2x" =~ /\p{Greek}/

with "t.rb:2: invalid character property name {Greek}: /\p{Greek}/"

The reason is that the regexp has US-ASCII encoding, and in that encoding the property 'Greek' is not defined.

However, in this case, that's very unexpected behavior. I'd suggest that if a regular expression is US-ASCII, but is being compared to a string that is not US-ASCII, the regular expression should temporarily take on the same encoding as the string.



Dave


----------------------------------------
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://redmine.ruby-lang.org/my/account