configr icon indicating copy to clipboard operation
configr copied to clipboard

JSON Config and accented characters

Open prof4natore opened this issue 6 years ago • 3 comments

Hi, inside my json config file i've a string with accented character like Operatività but when i try to read the file with read.config it return to me this Operatività , some help please? Thanks in advance

prof4natore avatar Nov 08 '18 14:11 prof4natore

Hi, here is my test output and did not repeat the issue you mentioned.

$ cat test.json
{
  "a":"Operatività"
}
$ Rscript -e "configr::read.config('test.json')"
$a
[1] "Operatività"

You can try to use the INI, YAML and TOML format files and check it again. If the issue happens only in the JSON file, it is better to report it on jsonlite issues page.

If there are issues with all formats (JSON/YAML/INI/TOML), I guess you need to change or update the character encoding of R environment or operating system.

Miachol avatar Nov 08 '18 14:11 Miachol

Thanks for the response :), did you try it on windows?

prof4natore avatar Nov 09 '18 08:11 prof4natore

Here is my test output on windows:

> setwd(tempdir())
> configr::write.config(list(a="Operatività"), "test.json", "json")
[1] TRUE
> cat(paste0(readLines("test.json"), collapse = "\n"))
{
  "a": ["Operatività"]
}
> configr::read.config("test.json")
$`a`
[1] "Operatività"
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.5.0 magrittr_1.5   RcppTOML_0.1.3 ini_0.3.1      tools_3.5.0    glue_1.3.0     yaml_2.1.19   
 [8] Rcpp_0.12.17   stringi_1.1.7  stringr_1.3.1  jsonlite_1.5   configr_0.3.3

Miachol avatar Nov 09 '18 08:11 Miachol