File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
lib/ronin/support/encoding Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -178,8 +178,10 @@ def self.unescape(data)
178
178
scanner = StringScanner . new ( data )
179
179
180
180
until scanner . eos?
181
- unescaped << if ( unicode_escape = scanner . scan ( /\\ u[0-9a-fA-F]{4,8 }/ ) )
181
+ unescaped << if ( unicode_escape = scanner . scan ( /\\ u[0-9a-fA-F]{4}/ ) )
182
182
unicode_escape [ 2 ..] . to_i ( 16 ) . chr ( Encoding ::UTF_8 )
183
+ elsif ( unicode_escape = scanner . scan ( /\\ u\{ [0-9a-fA-F]{1,6}\} / ) )
184
+ unicode_escape [ 3 ..-2 ] . to_i ( 16 ) . chr ( Encoding ::UTF_8 )
183
185
elsif ( hex_escape = scanner . scan ( /\\ x[0-9a-fA-F]{1,2}/ ) )
184
186
hex_escape [ 2 ..] . to_i ( 16 ) . chr
185
187
elsif ( octal_escape = scanner . scan ( /\\ [0-7]{1,3}/ ) )
Original file line number Diff line number Diff line change 73
73
end
74
74
75
75
context "when the String contains escaped unicode characters" do
76
- subject { "\\ u00D8\\ u2070E " }
76
+ subject { "\\ u00D8\\ u{2070E} " }
77
77
78
78
let ( :unescaped ) { "Ø𠜎" }
79
79
Original file line number Diff line number Diff line change 178
178
end
179
179
180
180
context "when the given String contains escaped unicode characters" do
181
- let ( :data ) { "\\ u00D8\\ u2070E " }
181
+ let ( :data ) { "\\ u00D8\\ u{2070E} " }
182
182
let ( :unescaped ) { "Ø𠜎" }
183
183
184
184
it "must unescape the hexadecimal characters" do
You can’t perform that action at this time.
0 commit comments