Gson: Unable to parse 拧 character (\u009a) from JSON.

Created on 23 Jan 2019  路  4Comments  路  Source: google/gson

Whilst parsing JSON data from NASA's APOD API (this in particular), the following is returned: "Luk\u00e1\u009a Vesel\u00fd".

I would expect this to be parsed as Luk谩拧 Vesel媒, instead Luk谩職 Vesel媒 comes out. Interestingly, Postman also manages to parse the 2 other characters, but fails on the \u009a (拧) too.

It's entirely possible this isn't a GSON issue, but the 2nd and 3rd screenshots below do imply that.

Postman, Gson parsing, raw string:
image

Most helpful comment

As per the Unicode Latin-1 supplement code point \u009A stands for _Single Character Introducer_ and it is a control character thus having no graphical representation.

The character you are looking for is _LATIN SMALL LETTER S WITH CARON_, code point \u0161 as per the Latin Extended-A.

Also tested your text changing the character and it worked without any error.

All 4 comments

As per the Unicode Latin-1 supplement code point \u009A stands for _Single Character Introducer_ and it is a control character thus having no graphical representation.

The character you are looking for is _LATIN SMALL LETTER S WITH CARON_, code point \u0161 as per the Latin Extended-A.

Also tested your text changing the character and it worked without any error.

Hmm, so essentially the NASA API is returning the wrong character, or using the wrong unicode definition, and the reference site I listed is too?

I couldn't see a way to change the unicode version GSON uses, so this API's response is unusable without using some third party conversion, right?

@JakeSteam
The demo API call seems to return a wrong character that looks more of a typo. If you decode the "s with caron" in your issue title, you'll get \u0161 that is what you're actually expecting from the response, not \u009A.

Fair enough, I'll take it up with NASA then! Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LucianWang picture LucianWang  路  42Comments

GoogleCodeExporter picture GoogleCodeExporter  路  32Comments

GoogleCodeExporter picture GoogleCodeExporter  路  19Comments

JakeWharton picture JakeWharton  路  39Comments

GoogleCodeExporter picture GoogleCodeExporter  路  20Comments