-
Notifications
You must be signed in to change notification settings - Fork 655
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
It seems rCharts doesn't work well with Chinese #549
Comments
This could be a problem with Highcharts, since rCharts merely passes the data on to highcharts. If you can post a minimal reproducible example, it would be useful to help debug. |
I found iconv helps... with some letters,but there are still some gibberish . |
I might be able to figure out what went wrong here, but I probably do not have enough time for it at the moment. |
It appears this is only an issue for Windows. Under Mac if you set locale to UTF-8 and specify However R Windows doesn't appear to support an UTF-8 locale. When rCharts write stuff to a file, it uses your default locale but marks the HTML file using utf-8 charset. If we change the meta tag in HTML to gb2312 (or manually change encoding in browser), it will work fine. Long story short, I think we can fix this by using I have created a patch and you can give it a try by If this works for you, let us know and I'll submit a pull request for this to merged. |
Yes, @saurfang is on the correct way. Actually we've done it on Here is a quick and temporal workaround:
|
Thank you all very much,I will try it today,if it works or not, I will let you know @saurfang. |
@saurfang I'm sorry to tell you that after installing your rChart,when I use rChart to draw something(even if the demo on rcharts.io),it can't be seen on the viewer, and R kept warning me like this
I used the following command to install your package. remove.packages("rCharts")
devtools::install_github("saurfang/rCharts", ref = "utf8-writelines") And later I reinstalled the master version of rCharts, it became OK. |
@FingerLiu See my comment at #552 (diff) |
We see |
Ah yes. My bad. Thanks @yihui How about a |
That sounds like a good idea @FingerLiu. Can you make that change in the PR? |
Alright changes have been made that we now use Do you guys mind giving it a code review and let me know your thoughts? #552 |
Hi,@saurfang ,thanks for fixing this. I try again and it works fine with the example above. But when I read a csv encode in UTF-8,it goes wrong again. paresed_data <- read.csv("data//utf8.csv",header = TRUE,sep = ",",quote="",stringsAsFactors = FALSE,encoding = "utf-8") Am I doing sth wrong?
|
@FingerLiu try |
It seems rCharts doesn't work well with Chinese
Background:
I've a csv cotains chinese characters,which is encoded in gb2313(system default) a sample of my csv is
Problem:
I read them into R using read.csv,and it can be correctly print out in R Console.
But when I try to put the values into a label of hChart,its' shown as gibberish(characters with no meaning)
I'v tried
Encoding(title)<- "UTF-8"
andenc2utf8()
,they don't work ,either.How can I fix this??Any idea would be great helpful
Other Info:
R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
[2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
[3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RJSONIO_1.3-0 httr_0.5 rCharts_0.4.5
loaded via a namespace (and not attached):
[1] grid_3.1.1 lattice_0.20-29 plyr_1.8.1 Rcpp_0.11.3 stringr_0.6.2 tools_3.1.1
[7] whisker_0.3-2 yaml_2.1.13
The text was updated successfully, but these errors were encountered: