File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
src/org/openqa/selenium/json
test/org/openqa/selenium/json Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import java .io .Closeable ;
21
21
import java .io .IOException ;
22
- import java .io .StringReader ;
23
22
import java .io .UncheckedIOException ;
24
23
import java .lang .reflect .Type ;
25
24
import java .math .BigDecimal ;
@@ -388,7 +387,7 @@ private void readEscape(StringBuilder builder) {
388
387
result += digit * multiplier ;
389
388
multiplier /= 16 ;
390
389
}
391
- builder .append (result );
390
+ builder .append (( char ) result );
392
391
break ;
393
392
394
393
case '/' :
Original file line number Diff line number Diff line change 21
21
import static org .junit .Assert .assertFalse ;
22
22
import static org .junit .Assert .assertNull ;
23
23
import static org .junit .Assert .assertTrue ;
24
+ import static org .openqa .selenium .json .Json .MAP_TYPE ;
24
25
25
26
import com .google .common .collect .ImmutableList ;
26
27
import com .google .common .collect .ImmutableMap ;
29
30
import org .junit .Test ;
30
31
31
32
import java .io .StringReader ;
33
+ import java .util .Map ;
32
34
33
35
public class JsonInputTest {
34
36
@@ -187,6 +189,17 @@ public void nestedMapIsFine() {
187
189
input .endObject ();
188
190
}
189
191
192
+ @ Test
193
+ public void shouldDecodeUnicodeEscapesProperly () {
194
+ String raw = "{\" text\" : \" \\ u003Chtml\" }" ;
195
+
196
+ try (JsonInput in = new JsonInput (new StringReader (raw ), new JsonTypeCoercer ())) {
197
+ Map <String , Object > map = in .read (MAP_TYPE );
198
+
199
+ assertEquals ("<html" , map .get ("text" ));
200
+ }
201
+ }
202
+
190
203
private JsonInput newInput (Object toParse ) {
191
204
String raw = new Gson ().toJson (toParse );
192
205
StringReader reader = new StringReader (raw );
You can’t perform that action at this time.
0 commit comments