Project

General

Profile

Actions

Bug #172

closed

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

Added by pragdave (Dave Thomas) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-core:17279]

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

Actions #1

Updated by Anonymous over 16 years ago

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

=begin
Applied in changeset r17882.
=end

Actions

Also available in: Atom PDF

Like0
Like0