wbuchanan / StataJSON

JSON IO operations for Stata using the Jackson Java Library
http://wbuchanan.github.io/StataJSON
21 stars 6 forks source link

how to import json with Chinese characters? #17

Closed luckykong closed 8 years ago

luckykong commented 8 years ago

when i run jsonio kv, file(http://maps.google.cn/maps/api/geocode/json?address=ningyang&language=zh-CN&region=cn) those Chinese characters will be transformed into "???"

how to solve this mistake?

wbuchanan commented 8 years ago

Hi @luckykong,

Which version of Stata are you using? This is probably unavoidable with Stata 13, but I'll see what I can figure out for Stata 14. It may be possible to solve things by adding a parameter to pass an encoding value.

Thanks again, Billy

luckykong commented 8 years ago

thank you very much for your reply. I am using Stata 14, and looking forward for your solution

wbuchanan commented 8 years ago

@luckykong still haven't been able to figure out a solution to the Chinese character encoding issue, but can you return the payload using English? If you change your URL to:

http://maps.google.cn/maps/api/geocode/json?address=ningyang&language=en

You shouldn't have an issues with things, although I can understand there may be words that don't have a reasonable translation. My best guess is that the API is returning those strings in an encoding that isn't supported by the underlying Java library/part of the JSON specification.

luckykong commented 8 years ago

Thank you for your hard work. It's a good advice to change it to English, and i will follow your advice in current project. Hope the next version of Stata software could solve this question.