리눅스맨

웹서버 한글파일 다운로드 안될때 리눅스 파일 인코딩 방법

Background Image
1,000만원 수익
Overlay Image

웹서버 운영하다보면 한글파일을 다운받아야하는경우가 있습니다.

그런데 한글을 인식못하여서 다운로드가 안될때 파일명을 인코딩하여 다운받는 방법이 있습니다.

한글 유형이 EUC-KR, CP949 등 많습니다.

우선 범용적으로 접속할수있도록 해야하니 최종 인코딩은 UTF-8로 지정해야합니다.

yum install convmv.noarch
convmv -f cp949 -t utf8 -r --notest ../app/

 

euckr -> utf8

cp949 -> utf8

 

이렇게 한글로 된 파일이름을 변환해주면 외부에서 접근이 가능해집니다.

폴더를 전체를 걸어도 되며 원하는 방식대로 할수 있어 좋더군요

이제 한글파일도 다운로드가 가능해졌습니다.

덕분에 자동화프로그램의 자동업데이트 기능을 한글파일 그대로 다운받아서 할 수 있게되었네요.

 convmv noarch 1.15-2.el7 base 31 k

이제 한글로 된 파일도 서버 인코딩 바꾸지 않고 쉽게 바꾸실수있습니다.

 

 

convmv 1.15 - converts filenames from one encoding to another
Copyright (C) 2003-2011 Bjoern JACKE <bjoern@j3e.de>

This program comes with ABSOLUTELY NO WARRANTY; it may be copied or modified
under the terms of the GNU General Public License version 2 or 3 as published
by the Free Software Foundation.

USAGE: convmv [options] FILE(S)
-f enc encoding *from* which should be converted
-t enc encoding *to* which should be converted
-r recursively go through directories
-i interactive mode (ask for each action)
--nfc target files will be normalization form C for UTF-8 (Linux etc.)
--nfd target files will be normalization form D for UTF-8 (OS X etc.)
--qfrom be quiet about the "from" of a rename (if it screws up your terminal e.g.)
--qto be quiet about the "to" of a rename (if it screws up your terminal e.g.)
--exec c execute command instead of rename (use #1 and #2 and see man page)
--list list all available encodings
--lowmem keep memory footprint low (see man page)
--nosmart ignore if files already seem to be UTF-8 and convert if posible
--notest actually do rename the files
--replace will replace files if they are equal
--unescape convert%20ugly%20escape%20sequences
--upper turn to upper case
--lower turn to lower case
--parsable write a parsable todo list (see man page)
--help print this help

 

 

Background Image
1,000만원 수익
Overlay Image

게시됨

카테고리

,

작성자

태그: