我知道在OSX下可以使用以下命令将单个文件编码转换为UTF-8:
希望有人能够提供如何执行此操作的语法。
谢谢。
ekke
iconv -f ISO-8859-1 -t UTF-8 myfilename.xxx > myfilename-utf8.xxx
我需要对一堆特定扩展名的文件进行转换,所以我想将文件编码从ISO-8859-1转换为UTF-8,适用于/mydisk/myfolder中所有*.ext文件。希望有人能够提供如何执行此操作的语法。
谢谢。
ekke
#!/bin/bash find ./tmp -type f | \ (while read file; do iconv -f windows-1251 -t UTF-8 "$file" -o "$file"; done);
- temni#!/bin/bash find ./src -type f | \ (while read file ; do if [[ "$file" != *.DS_Store* ]]; then if [[ "$file" != *-utf8* ]]; then iconv -f CP1251 -t UTF-8 "$file" > "$file-utf8"; rm $file; mv "$file-utf8" "$file"; fi fi done);
- Roman Trubafind ./ -name AppLocalization.resx -type f | (while read file; do iconv -f UTF-16LE -t UTF-8 AppLocalization.resx > "AppLocalization-UTF-8.resx"; done);
- jfmg