Feature #3619
Updated by naruse (Yui NARUSE) almost 13 years ago
=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