반응형
리눅스를 사용하다보면 가끔 한글이 깨지는 경우가 있다.
한번만 사용하는거라면 크게 상관은 없지만 계속 사용해야하는 파일은 신경이 쓰이게 된다.
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/040.gif)
터미널 환경에 따라 달라지고 그에 따른 환경에 맞게 터미널 환경을 변경 해도 되지만....
필자의 경우 Mac을 사용하고 기본적으로 터미널 환경에서는 utf-8 환경을 사용하고 있는데
간혹 euc-kr로 인코딩이 되어 있어 한글이 깨져보일때가 있다.
먼저 파일의 인코딩 확인 하는 방법이다.
[파일 인코딩 확인]
$ file -bi [FILENAME]
text/plain; charset=iso-8859-1
[파일 인코딩 변환]
usage) iconv -c -t iso-8859-1 -t utf-8 원래파일명 > 변환된후 파일명
$ iconv -c -t iso-8859-1 -t utf-8 aa.txt > bb.txt # 아무런 결과 출력이 없다.
[파일 인코딩 변환 확인]
$ file -bi bb.txt
text/plain; charset=utf-8
2022년 새해 첫 글이네요...
새해복 많이 받으세요~
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/008.gif)
반응형
'운영체제 > Linux' 카테고리의 다른 글
[Linux] Hex <-> Dec 변환 (0) | 2022.11.22 |
---|---|
[Linux] unix Timestamp 를 date로 변환 (1) | 2022.11.22 |
[Linux] mount fail "Mounting V5 Filesystem...Ending clean mount" Error 발생 (0) | 2021.12.07 |
[Linux] mount fail : structure needs cleaning (구조에 청소가 필요합니다) (0) | 2021.04.28 |
[Linux] Linux PW + Google OTP 한번에 같이 입력하기....(Password & verification code) (0) | 2020.11.11 |