Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The program does not support writing in UTF8 or Chinese character! what should I do? #33

Open
homecls opened this issue Jan 23, 2019 · 3 comments

Comments

@homecls
Copy link

homecls commented Jan 23, 2019

The program does not support writing JSON object to disk in UTF8 or Chinese character!
However, does support writing JSON object to stata console in UTF8 or Chinese character!

what should I do?

@wbuchanan
Copy link
Owner

Can you provide a reproducible example? And can you also include which version of Stata and jsonio you are using? It may be related to the accessor methods that were present in Stata 14 when the program was developed. If that is the case I am always open to collaborating with others who can help to address those issues. Otherwise it will likely take me a fair amount of time to trace, identify, and fix any underlying issues.

@homecls
Copy link
Author

homecls commented Jan 23, 2019

@wbuchanan Thanks !!
the Jsonio version: Distribution-Date: 20170504
the stata version: se/15

stata code:

clear
input No str16 Nation
       1  "US"
       2  "中国"
end
jsonio out, what(data) 
jsonio out, what(data) file(res.json)

the result in the json file is
{
"source" : "Stata Data",
"name" : "DataSet",
"data" : [ {
"Nation" : "US",
"No" : 1.0
}, {
"Nation" : "中�",
"No" : 2.0
} ]
}

the result should be
{
"source" : "Stata Data",
"name" : "DataSet",
"data" : [ {
"Nation" : "US",
"No" : 1.0
}, {
"Nation" : "中国",
"No" : 2.0
} ]
}

@wbuchanan
Copy link
Owner

@homecls
Sorry it took a while to get back to this. I just tried the example you provided above and this is what I copied from the resulting res.json file:

{
  "source" : "Stata Data",
  "name" : "DataSet",
  "data" : [ {
    "Nation" : "US",
    "No" : 1.0
  }, {
    "Nation" : "中国",
    "No" : 2.0
  } ]
}

Can you confirm whether/if this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants