Giter Site home page Giter Site logo

Comments (2)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 21, 2024
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 [email protected] on 4 Feb 2015 at 4:45

from json-smart.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 21, 2024
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

  • Changed state: Fixed

from json-smart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.