Fix for issue 48: JSONValue.parse does not correctly decode UTF-8 bytes from an inputstream #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a possible fix for issue 48 (https://code.google.com/p/json-smart/issues/detail?id=48).
The problem seemed to be that the parsing for InputStreams was taking a byte at a time from the InputStream and considering that byte to be a character. This causes some strangeness when parsing UTF characters beyond the usual ascii range.
The changes are confined to just the JSONParserInputStream class. Instead of using the InputStream directly, it now wraps it in a InputStreamReader (http://docs.oracle.com/javase/7/docs/api/java/io/InputStreamReader.html) which deals with multi-byte characters. As a side effect of wrapping it up in a Reader, the JSONParserReader can be used instead, which is why the class now extends JSONParserReader.
Hope this helps.
I'm less familiar with json-smart-v2, but could have a go at fixing the issue in that version too if you want.