Convert multiple files to new encoding, TIS-620 to UTF-8, ASCII to UTF-8, so on.
iconvavailabe for OSX, linux
example for .aspx.list file. ! you can change filename to anothor.
./folder-a/folder-b/file1.txt
./folder-a/file2.txt
./folder-a/file3.txtor use command for file list of your files by find command.
find . -type f -exec file --mime {} \;|grep aspx|grep -v charset=utf-8 > .aspx.list-type f, find only file. --- ค้นหาเฉพาะที่เป็นไฟล์เท่านั้น-exec file --mime {} \;, display perference of file that be found --- แสดงคุณลักษณะของไฟล์นั้นๆgrep aspx, keep the line includeaspx--- แสดงบรรทัดที่มีข้อความว่าaspxgrep -v charset=utf-8, discard the line includingcharset=utf-8--- ตัดบรรทัดที่มีข้อความว่าcharset=utf-8ออก
- setting parameter in file
encoding-converter.sh
...
######################
# Setting Parameters #
######################
FROM_ENC=TIS-620 # Convert from ${FROM_ENC} encoding --- ระบุ encoding ของไฟล์เดิม
TO_ENC=UTF-8 # Convert to ${TO_ENC} encoding. --- ระบุ encoding ใหม่ให้ไฟล์
INPUT_FILE=./.aspx.list # list of files will be converted. ! it should be full path --- ควรใช้เป็น full-path เท่านั้น, ชื่อไฟล์เปลี่ยนตามที่เราเตรียมไว้
...- run file
encoding-converter.sh, which is the same path of list of files.
./encoding-converter.sh- Additional, the original file will stored inside
.BACKUP-YYY-mm-dddirectory