windows - Need a simple program to convert to utf-8

25
2014-03
  • Null

    Possible Duplicates:
    App to convert from ANSI to UTF8 on windows
    Batch-convert files for encoding or line ending under Windows

    I need to find a program to convert a Windows-1250 encoded file to utf8. It needs to be a standalone program (not a python script) and it needs to run on windows (without install). If I can make the conversion using the commandline that would be perfect.

    Yes I know notepad can do that but this is meant to be automated.

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    linux - How can I convert multiple files to UTF-8 encoding using *nix command line tools?
  • jason

    Possible Duplicate:
    Batch-convert files for encoding or line ending

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

    Are there any command line tools or Perl (or language of your choice) one liners I can use to do this en masse?


  • Related Answers
  • grawity

    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.