lee11
May 16, 2019, 1:06pm
1
Hi all,
It is very strange - R used to recognize Korean before, but it does not seem that it can do it now anymore. For instance, when I do:
a <- "안녕"
a
then I get
"\354\225\210\353\205\225"
Likewise, I have a tsv that is in Korean, and R does not correctly display the Korean characters. Does anyone know how I can fix this problem?
encoding is already in UTF-8, and locale("ko") gives:
readr(library)
lokale ("ko")
Numbers: 123,456.78
Formats: %AD / %AT
Timezone: UTC
Encoding: UTF-8
<date_names>
Days: <U+C77C><U+C694><U+C77C> (<U+C77C>), <U+C6D4><U+C694><U+C77C> (<U+C6D4>), <U+D654><U+C694><U+C77C> (<U+D654>), <U+C218><U+C694><U+C77C> (<U+C218>), <U+BAA9><U+C694><U+C77C> (<U+BAA9>), <U+AE08><U+C694><U+C77C> (<U+AE08>),
<U+D1A0><U+C694><U+C77C> (<U+D1A0>)
Months: 1<U+C6D4>, 2<U+C6D4>, 3<U+C6D4>, 4<U+C6D4>, 5<U+C6D4>, 6<U+C6D4>, 7<U+C6D4>, 8<U+C6D4>, 9<U+C6D4>, 10<U+C6D4>, 11<U+C6D4>, 12<U+C6D4>
AM/PM: <U+C624><U+C804>/<U+C624><U+D6C4>
mara
May 16, 2019, 2:15pm
2
I'm not able to reproduce this, could you run this as a reprex, or give some more information about your setup (R version, RStudio version, if you're using it, etc.)?
a <- "안녕"
a
#> [1] "안녕"
Created on 2019-05-16 by the reprex package (v0.2.1)
Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#> setting value
#> version R version 3.5.3 (2019-03-11)
#> os macOS Mojave 10.14.4
#> system x86_64, darwin15.6.0
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/New_York
#> date 2019-05-16
#>
#> ─ Packages ──────────────────────────────────────────────────────────────
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.5.3)
#> backports 1.1.4 2019-04-10 [1] CRAN (R 3.5.2)
#> callr 3.2.0 2019-03-15 [1] CRAN (R 3.5.2)
#> cli 1.1.0 2019-03-19 [1] CRAN (R 3.5.2)
#> crayon 1.3.4 2019-04-03 [1] Github (r-lib/crayon@84be620)
#> desc 1.2.0 2019-03-29 [1] Github (r-lib/desc@c860e7b)
#> devtools 2.0.2 2019-04-08 [1] CRAN (R 3.5.3)
#> digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.0)
#> evaluate 0.13 2019-02-12 [1] CRAN (R 3.5.2)
#> fs 1.3.1 2019-05-06 [1] CRAN (R 3.5.2)
#> glue 1.3.1 2019-03-12 [1] CRAN (R 3.5.2)
#> highr 0.8 2019-03-20 [1] CRAN (R 3.5.3)
#> htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.0)
#> knitr 1.22 2019-03-08 [1] CRAN (R 3.5.2)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)
#> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.0)
#> pkgbuild 1.0.3 2019-03-20 [1] CRAN (R 3.5.3)
#> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.1)
#> prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)
#> processx 3.3.1.9000 2019-05-13 [1] Github (r-lib/processx@505cb1f)
#> ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.0)
#> R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.2)
#> Rcpp 1.0.1 2019-03-17 [1] CRAN (R 3.5.2)
#> remotes 2.0.4 2019-04-10 [1] CRAN (R 3.5.2)
#> rlang 0.3.4.9003 2019-05-06 [1] Github (r-lib/rlang@6a232c0)
#> rmarkdown 1.12 2019-03-14 [1] CRAN (R 3.5.2)
#> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.0)
#> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.5.2)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.5.2)
#> testthat 2.1.1 2019-04-23 [1] CRAN (R 3.5.2)
#> usethis 1.5.0.9000 2019-05-08 [1] local
#> withr 2.1.2.9000 2019-05-15 [1] Github (r-lib/withr@79c5e36)
#> xfun 0.7.1 2019-05-15 [1] Github (yihui/xfun@a552dc0)
#> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library
1 Like
lee11
May 16, 2019, 5:47pm
3
Hi Mara,
Thanks for the reply.
I somehow figured out the answer myself!
For those who might see this post in the future,
using the below code solved the problem:
Sys.setlocale("LC_CTYPE", "ko_KR.UTF-8")
Thank you nonetheless
3 Likes
system
Closed
May 23, 2019, 5:47pm
4
This topic was automatically closed 7 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.