Issue #3619 has been updated by naruse.

Description updated
Status changed from Open to Rejected


----------------------------------------
Feature #3619: \x{XXXX} as an escape sequence of string
https://bugs.ruby-lang.org/issues/3619#change-24731

Author: phasis68
Status: Rejected
Priority: Low
Assignee: 
Category: core
Target version: 2.0.0


=begin
 I noticed String#inspect results \x{XXXX} for the encoding other than Unicode.
 
 Is there any possibility that \x{XXXX} is accepted as an escape sequence of string?
 
 irb(main):004:0> a = "\xC7\xD1\xB1\xDB"
 => "\xC7ѱ\xDB"
 irb(main):005:0> a.encoding
 => #<Encoding:UTF-8>
 irb(main):006:0> a.force_encoding('EUC-KR')
 => "\x{C7D1}\x{B1DB}"
 irb(main):007:0> a.encode('UTF-8')
 => "????"
 irb(main):008:0> a
 => "\x{C7D1}\x{B1DB}"
 irb(main):009:0> a[0]
 => "\x{C7D1}"
 irb(main):010:0> a[1]
 => "\x{B1DB}"
 irb(main):011:0> b = "\x{B1DB}"
 SyntaxError: (irb):11: invalid hex escape
 b = "\x{B1DB}"
        ^
 	from /usr/local/bin/irb:12:in `<main>'
=end



-- 
http://bugs.ruby-lang.org/