Bug #172

Regular expressions should inherit encoding of context even if they only contain 7-bit chars

Added by Dave Thomas almost 7 years ago. Updated almost 4 years ago.

[ruby-core:17279]
Status:Closed
Priority:Normal
Assignee:-
ruby -v: Backport:

Description

=begin
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
=end

History

#1 Updated by Anonymous almost 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r17882.
=end

Also available in: Atom PDF