[Bug] Non-ASCII characters and JSONP callbacks

So, there’s apparently a bug where if you give a JSONP callback, it will corrupt non-ASCII characters in the response.

With:
https://api.twitch.tv/kraken/search/games?callback=jQuery111301253698337035638_1485429756905&type=suggest&query=pokemon%20sun&_method=GET&api_version=5&client_id=

Without:
https://api.twitch.tv/kraken/search/games?type=suggest&query=pokemon%20sun&_method=GET&api_version=5&client_id=

Apparently this query works for some reason:
https://api.twitch.tv/kraken/search/games?callback=jQuery111301253698337035638_1485429756905&type=suggest&query=pokemon%20s&_method=GET&api_version=5&client_id=

Really have no idea what is going on here…
Is it a browser issue, where it’s not decoding it properly due to the JSONP content-type:application/javascript?

Done some digging and the /search/game endpoint doesn’t return "Content-Type application/json; charset=utf-8" like the other endpoints, it returns"Content-Type application/json"

Likely the cause, and just Chrome that is detecting and decoding it properly when it’s not content-type:application/javascript?

When I pulled this on chrome, I got the

but when I tried it with lynx on one of my servers it pulled:

/**/jQuery111301253698337035638_1485429756905({
“games”:[
{
“name”:“Pokémon Sun/Moon”,
“popularity”:7499,
“_id”:491599,
“giantbomb_id”:52769,
“box”:{
“large”:“https://static-cdn.jtvnw.net/ttv-boxart/Pokémon%20Sun/Moon-272x380.jpg”,
“medium”:“https://static-cdn.jtvnw.net/ttv-boxart/Pokémon%20Sun/Moon-136x190.jpg”,
“small”:“https://static-cdn.jtvnw.net/ttv-boxart/Pokémon%20Sun/Moon-52x72.jpg”,
“template”:“https://static-cdn.jtvnw.net/ttv-boxart/Pokémon%20Sun/Moon-{width}x{height}.jpg
},
“logo”:{
“large”:“https://static-cdn.jtvnw.net/ttv-logoart/Pokémon%20Sun/Moon-240x144.jpg”,
“medium”:“https://static-cdn.jtvnw.net/ttv-logoart/Pokémon%20Sun/Moon-120x72.jpg”,
“small”:“https://static-cdn.jtvnw.net/ttv-logoart/Pokémon%20Sun/Moon-60x36.jpg”,
“template”:“https://static-cdn.jtvnw.net/ttv-logoart/Pokémon%20Sun/Moon-{width}x{height}.jpg
}
}
]
})

When I dropped the JSON from lynx into https://jsonformatter.curiousconcept.com/ I got:

INVALID JSON (RFC 4627)
Error:Expecting object or array, not string.[Code 1, Structure 1]
Error:Strings should be wrapped in double quotes.[Code 17, Structure 1]
Error:Invalid string[Code 15, Structure 65]

I use a JSON formatting extension for chrome, but regardless if its running or not, I do see:

{“name”:“PokĆ©mon Sun/Moon”

FYI, I’m reporting this to the team. Will get back to you soon!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.