【터미널】일본어가 깨져 버릴 때의 해결 방법(환경 변수의 설정까지)
ls
실행했을 때…터미널
lancai@oja Desktop % ls -l
total 23336
drwxr-xr-x@ 27 lancai staff 864 Feb 29 14:14 ajax_crud_sample
drwxr-xr-x 4 lancai staff 128 Feb 27 23:57 git_sample
drwxr-xr-x 4 lancai staff 128 Feb 27 23:05 hell
drwxr-xr-x@ 4 lancai staff 128 Mar 1 13:25 hello
drwxr-xr-x 3 lancai staff 96 Feb 29 14:08 helloHeroku
drwxr-xr-x 13 lancai staff 416 Mar 12 22:27 joint_dev_task
drwxr-xr-x 5 lancai staff 160 Mar 21 16:15 mosha
drwxr-xr-x@ 9 lancai staff 288 Mar 26 22:19 npm_sample
-rw-r--r--@ 1 lancai staff 4634176 Mar 26 22:23 ??????????????????????????? 2020-03-26 22.23.14.png
-rw-r--r--@ 1 lancai staff 2202423 Mar 27 21:08 ??????????????????????????? 2020-03-27 21.07.57.png
-rw-r--r--@ 1 lancai staff 5104788 Mar 27 21:58 ??????????????????????????? 2020-03-27 21.58.42.png
아래 3행의 파일명이 깨져서 「😶!?」
그러고 보면 Ruby나 무언가의 환경 구축할 때 일본어를 치면 문자가 깨졌지만 해결되지 않고 그대로 있었구나… 라고! !
그래서 이것을 계기에 여러 가지 구그 결과, 해결했기 때문에 그 방법을 기록해 갑니다.
터미널 설정
터미널 > 환경설정 > 프로필 > 상세
↑적색의 원형 표시 2개소가 화상대로 되어 있는지 체크
터미널 > 환경설정 > 인코딩
↑화상대로 Unicode(UTF-8)에 체크
LANG 값 확인
자신의 홈 디렉토리에서 다음을 실행
※홈 디렉토리・・・터미널로 cd
를 실행했을 때에 이동할 수 있다.
터미널lancai@oja % echo $LANG
C
※↑여기서 ja_JP.UTF-8
라고 나오면 해결이라는 것이지만, C
라고 표시된다.
현재 사용 중인 쉘 표시
lancai@oja ~ % echo $SHELL
/bin/zsh
자신의 홈 디렉토리에서 다음을 실행
※홈 디렉토리・・・터미널로
cd
를 실행했을 때에 이동할 수 있다.터미널
lancai@oja % echo $LANG
C
※↑여기서
ja_JP.UTF-8
라고 나오면 해결이라는 것이지만, C
라고 표시된다.현재 사용 중인 쉘 표시
lancai@oja ~ % echo $SHELL
/bin/zsh
lancai@oja ~ % echo $SHELL
/bin/zsh
/bin/zsh
가 표시되면 ~/.zshenv
/bin/bash
가 표시되면 ~/.bash_profile
파일 중 하나에
export LANG=ja_JP.UTF-8
를 추가하십시오. (= 환경 변수 설정 완료)내 경우에는
/bin/zsh
가 표시되었으므로 ~/.zshenv
에 export LANG=ja_JP.UTF-8
를 추가하여환경 변수 설정이 완료된다는 것입니다.
~/.zshenv 및 ~/.bash_profile 위치
홈 디렉토리에있는 것 같습니다.
홈 디렉토리로 이동
터미널lancai@oja desktop % cd
lancai@oja ~ %
홈 디렉토리에 있는 파일 등을 표시
lancai@oja ~ % ls -a
. .nodebrew Library
.. .npm Movies
.CFUserTextEncoding .oracle_jre_usage Music
.DS_Store .rbenv MyVagrant
.Trash .ssh Pictures
.atom .subversion Public
.bash_profile .vagrant.d VirtualBox VMs
.bash_profile.swp .viminfo afax_crud_sample
.bash_profile.txt .vscode agametter_app
.bashrc .yarnrc ajax_crud_sample
.bundle .zsh_history demo
.config .zshrc dq_like_app
.gem .zshrc.swp es6_sample
.gitconfig Applications gitwork
.inputrc.txt Desktop hello
.local Documents
.netrc Downloads
본래 위에 들어있는 것 같습니다.
분명히 내 경우에는 ~/.zshenv
가 없었던 것 같습니다.
다음과 같은 방법으로 만들었습니다.
↓
touch로 텍스트 파일 만들기
터미널lancai@oja ~ % touch ~/.zshenv
↓ 작성할 수 있었을 것이므로 open
로 열린다(텍스트 에디터가 열립니다)
lancai@oja ~ % open ~/.zshenv
텍스트 편집기에 export LANG=ja_JP.UTF-8
를 입력하고 저장
터미널로 돌아가서 다음을 실행
lancai@oja ~ % exec $SHELL -l
LANG 값 확인
lancai@oja ~ % echo $LANG
ja_JP.UTF-8
ja_JP.UTF-8
로 설정할 수 있었던 것 같기 때문에 desktop에서 ls
실행
lancai@oja ~ % cd desktop
lancai@oja desktop % ls
ajax_crud_sample
git_sample
hell
hello
helloHeroku
joint_dev_task
mosha
npm_sample
スクリーンショット 2020-03-26 22.23.14.png
スクリーンショット 2020-03-27 21.07.57.png
スクリーンショット 2020-03-27 21.58.42.png
일본어의 깨진 부분이 해소되었습니다 👍
Reference
이 문제에 관하여(【터미널】일본어가 깨져 버릴 때의 해결 방법(환경 변수의 설정까지)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/Lancai/items/2171e49e3733aab9ece6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
터미널
lancai@oja desktop % cd
lancai@oja ~ %
홈 디렉토리에 있는 파일 등을 표시
lancai@oja ~ % ls -a
. .nodebrew Library
.. .npm Movies
.CFUserTextEncoding .oracle_jre_usage Music
.DS_Store .rbenv MyVagrant
.Trash .ssh Pictures
.atom .subversion Public
.bash_profile .vagrant.d VirtualBox VMs
.bash_profile.swp .viminfo afax_crud_sample
.bash_profile.txt .vscode agametter_app
.bashrc .yarnrc ajax_crud_sample
.bundle .zsh_history demo
.config .zshrc dq_like_app
.gem .zshrc.swp es6_sample
.gitconfig Applications gitwork
.inputrc.txt Desktop hello
.local Documents
.netrc Downloads
본래 위에 들어있는 것 같습니다.
분명히 내 경우에는
~/.zshenv
가 없었던 것 같습니다.다음과 같은 방법으로 만들었습니다.
↓
touch로 텍스트 파일 만들기
터미널lancai@oja ~ % touch ~/.zshenv
↓ 작성할 수 있었을 것이므로 open
로 열린다(텍스트 에디터가 열립니다)
lancai@oja ~ % open ~/.zshenv
텍스트 편집기에 export LANG=ja_JP.UTF-8
를 입력하고 저장
터미널로 돌아가서 다음을 실행
lancai@oja ~ % exec $SHELL -l
LANG 값 확인
lancai@oja ~ % echo $LANG
ja_JP.UTF-8
ja_JP.UTF-8
로 설정할 수 있었던 것 같기 때문에 desktop에서 ls
실행
lancai@oja ~ % cd desktop
lancai@oja desktop % ls
ajax_crud_sample
git_sample
hell
hello
helloHeroku
joint_dev_task
mosha
npm_sample
スクリーンショット 2020-03-26 22.23.14.png
スクリーンショット 2020-03-27 21.07.57.png
スクリーンショット 2020-03-27 21.58.42.png
일본어의 깨진 부분이 해소되었습니다 👍
Reference
이 문제에 관하여(【터미널】일본어가 깨져 버릴 때의 해결 방법(환경 변수의 설정까지)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/Lancai/items/2171e49e3733aab9ece6
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
lancai@oja ~ % touch ~/.zshenv
lancai@oja ~ % open ~/.zshenv
lancai@oja ~ % exec $SHELL -l
lancai@oja ~ % echo $LANG
ja_JP.UTF-8
lancai@oja ~ % cd desktop
lancai@oja desktop % ls
ajax_crud_sample
git_sample
hell
hello
helloHeroku
joint_dev_task
mosha
npm_sample
スクリーンショット 2020-03-26 22.23.14.png
スクリーンショット 2020-03-27 21.07.57.png
スクリーンショット 2020-03-27 21.58.42.png
Reference
이 문제에 관하여(【터미널】일본어가 깨져 버릴 때의 해결 방법(환경 변수의 설정까지)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/Lancai/items/2171e49e3733aab9ece6텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)