Project

General

Profile

Actions

Bug #563

closed

Regexp::escape is not Encoding Aware

Added by JEG2 (James Gray) about 16 years ago. Updated over 13 years ago.

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

Description

=begin
Escaping an encoded String can damage the encoding:

s = "+"
=> "+"
s.encode!("UTF-16BE")
=> "\x00+"
re = Regexp.escape(s)
=> "\+"
re.encoding
=> #Encoding:UTF-16BE
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0