Home » Questions » Computers [ Ask a new question ]

How can I convert multiple files to UTF-8 encoding using *nix command line tools? [duplicate]

How can I convert multiple files to UTF-8 encoding using *nix command line tools? [duplicate]

I have a bunch of text files that I'd like to convert from any given charset to UTF-8 encoding.

Asked by: Guest | Views: 473
Total answers/comments: 2
Guest [Entry]

"iconv does convert between many character encodings. So adding a little bash magic and we can write

for file in *.txt; do
iconv -f ascii -t utf-8 ""$file"" -o ""${file%.txt}.utf8.txt""
done

This will run iconv -f ascii -t utf-8 to every file ending in .txt, sending the recoded file to a file with the same name but ending in .utf8.txt instead of .txt.

It's not as if this would actually do anything to your files (because ASCII is a subset of UTF-8), but to answer your question about how to convert between encodings."
Vzisto [Entry]

buy lipitor generic <a href="https://lipiws.top/">buy lipitor 20mg</a> atorvastatin without prescription