wbuchanan / StataJSON

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

The program does not support Reading in Chinese character #26

Open Stata-Club opened 7 years ago

Stata-Club commented 7 years ago

hello! When I using this program "jsonio" ,I found that this program does not read JSON file well when the file concludes Chinese character same as "北京市".These characters will be converted to "???" in Stata. This problem has a very negative impact on Chinese users.

here is a example JSON file

{
            "city_id": 158,
            "city_name": "长沙市",
            "location":
            {
                "lng": 112.95032970443,
                "lat": 28.185608728934
            }
}

Thank you :)

wbuchanan commented 7 years ago

@Stata-Club Is there a specific API returning these data? Do you know what string encoding is being used for the payload? And which version of Stata are you using?

I just tested things with the JSON object you provided above and the characters were correctly read. Perhaps it is an issue with specifying the string encoding within Stata?

Connected to the target VM, address: '127.0.0.1:51096', transport: 'socket'
Key =   /city_id    Value = 158
Key =   /city_name  Value = "长沙市"
Key =   /location/lng   Value = 112.95032970443
Key =   /location/lat   Value = 28.185608728934
Disconnected from the target VM, address: '127.0.0.1:51096', transport: 'socket'
Index = 0
Index = 1
Index = 2
Index = 3
Started Job at: 2017/11/01 15:02:05
Ended Job at : 2017/11/01 15:02:52
4 elements total
/city_id
/city_name
/location/lng
/location/lat

Process finished with exit code 0
homecls commented 5 years ago

The program does not support Writing in Chinese character! what should I do?

Stata-Club commented 5 years ago

I suggest that [insheetjson] program will solve it. you can type "ssc install insheetjson" to download.

At 2019-01-23 16:28:00, "homecls" notifications@github.com wrote:

The program does not support Writing in Chinese character! what should I do?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

wbuchanan commented 5 years ago

@Stata-Club I don’t think insheetjson provides a viable solution for writing JSON data to a file. I still haven’t had a chance to look into the issues with writing to disk, but think it might be related to the accessor methods from the Java API from version 14. Once I am able to look into things and verify I will update the issue.