Warning message: Character set is not UTF-8; please change your locale

Published by onesixx on

Character set is not UTF-8

해결1. Options

options(encoding = "UTF-8")

 On Ubuntu the default LANG is defined in /etc/default/locale

해결2. Ubuntu의 Locale값 수정

https://www.thomas-krenn.com/en/wiki/Configure_Locales_in_Ubuntu

ubuntu 세팅값 확인

|$ vi /etc/default/locale

#  File generated by update-locale
~

locale 값 현재 세팅

|$ locale

LANG=
LANGUAGE=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

사용가능한 locale값

|$  locale -a
C
C.UTF-8
POSIX

사용하고 싶은 “en_US.UTF-8” 이 없으면 추가

|$  # locale-gen en_US.UTF-8
Generating locales (this might take a while)...
  en_US.UTF-8... done
Generation complete.

|$ locale -a
C
C.UTF-8
POSIX
en_US.utf8

locale 값 조정

|$ vi /etc/default/locale

LANG=en_US.UTF-8

setlocale in r

readRenviron("/etc/default/locale")
LL <- Sys.getenv("LANG")   # en_US.UTF-8

if(nchar(LL))
  Sys.setlocale("LC_ALL", LL)

Sys.getlocale("LC_ALL")
Categories: R Basic

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x