Closed GoogleCodeExporter closed 8 years ago
I tried my hand at a fix for this for version 1 and created a pull request for
it.
I'd be happy to try applying a similar for to version 2, but am less familiar
with it.
Regardless of whether the pull request is accepted or not, a workaround could
be to just wrap the InputStream in a InputStreamReader
(http://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html) and
use the parse methods that take a Reader instead. e.g.
{{{
String testJsonString =
"{\"balance\":1000.21,\"num\":100,\"nickname\":null,\"is_vip\":true,\"Sinhalese\
":\"සිංහල ජාතිය\",\"name\":\"foo\"}";
ByteArrayInputStream bis = new
ByteArrayInputStream(testJsonString.getBytes(StandardCharsets.UTF_8));
JSONObject obj = JSONValue.parse(new InputStreamReader(bis,
StandardCharsets.UTF_8), JSONObject.class);
}}}
I noticed this same issue whilst using V1 of the library and parsing JSON
serially. The same workaround should work there too, e.g.:
{{{
JSONValue.SAXParse(new InputStreamReader(bis, StandardCharsets.UTF_8),
someHandler);
}}}
Original comment by toadm...@googlemail.com
on 4 Feb 2015 at 4:45
I have misunderstood, the json specs.
I have juste patch json-smart to handle InputStream as UTF-8 data for
json-smart V1 and V2.
Original comment by uriel.chemouni
on 20 Aug 2015 at 7:06
Original issue reported on code.google.com by
patrick....@gmail.com
on 13 Sep 2014 at 6:42