Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
App to convert from ANSI to UTF8 on windows

Does anyone know of a freeware or open source program to convert .txt files to unicode?

share|improve this question

marked as duplicate by quack quixote, Diago Jan 18 '10 at 6:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

As specified by Idigas, .txt is not an encoding. I'm assuming you meant these .txt files used the default encoding when you saved them, which I believe is set to ANSI if you used Notepad on Windows.

You'll need to know the initial format before converting them, but you can use iconv. You haven't specified your operating system, but you can get iconv for Linux, Windows, and Mac. I believe it is already included in most Linux distributions.

example:

$iconv -f ms-ansi -t utf-8 ansi.txt > utf-8.txt
share|improve this answer
    
+1 - Good answer. Windows binaries are available, courtesy of GNU Corporation :), from here: gnuwin32.sourceforge.net/packages/libiconv.htm –  ldigas Jan 18 '10 at 2:18
1  
If you are using non-Western Windows locale (specifically: system code page), you might need to pick a different input encoding than ms-ansi. ms-ansi here actually means code page 1252 Western European, which other locales wouldn't match. The naming of this code page “ANSI” has always been problematic; it is actually a Microsoft invention that has nothing to do with ANSI! –  bobince Jan 18 '10 at 2:26
    
Thanks for pointing that vital information out! As stated, you must know the initial format it was encoded in to be sure. –  John T Jan 18 '10 at 2:46
    
... which is sometimes mightly difficult to determine, expecially if one uses most english characters, and maybe a few others which are in several other sets (like many central european ones). –  ldigas Jan 18 '10 at 2:56
    
following bobince's comment, i believe "windows-1252" is a synonym for "ms-ansi" as far as iconv is concerned. i prefer it since it more accurately describes the actual encoding. –  quack quixote Jan 18 '10 at 4:50

.txt is a format, unicode is an encoding.

Did you mean, maybe, ASCII to let's say, UTF-16 ? Vim perhaps - not batch per se, but with its line command capabilities it can be made automated to a certain point. But this is merely speculating - could you please refine your question as to what you're trying to accomplish.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.