Chinese identification

X<-("中国")

x

[1] "\u6768\u5b8f"

Why does the output look like this?
I have tried "The Default text encoding" various forms ,like UTF-8,GB2312,but they don't have effect.
How should I set it?
RStudio's version is "R-4.0.4"
THANKS

This may be OS-dependent

X <-("中国")
X
#> [1] "中国"
sessionInfo()
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Pop!_OS 20.10
#> 
#> Matrix products: default
#> BLAS:   /usr/local/lib/R/lib/libRblas.so
#> LAPACK: /usr/local/lib/R/lib/libRlapack.so
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] knitr_1.31        magrittr_2.0.1    debugme_1.1.0     rlang_0.4.10     
#>  [5] fansi_0.4.2       stringr_1.4.0     styler_1.4.0      highr_0.8        
#>  [9] tools_4.0.4       xfun_0.22         utf8_1.2.1        htmltools_0.5.1.1
#> [13] ellipsis_0.3.1    yaml_2.2.1        digest_0.6.27     tibble_3.1.0     
#> [17] lifecycle_1.0.0   crayon_1.4.1      purrr_0.3.4       vctrs_0.3.7      
#> [21] fs_1.5.0          glue_1.4.2        evaluate_0.14     rmarkdown_2.7    
#> [25] reprex_1.0.0      stringi_1.5.3     compiler_4.0.4    pillar_1.5.1     
#> [29] backports_1.2.1   pkgconfig_2.0.3

I have solved this problem by updating the version, thank you very much, I wish you all the best in your work

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.