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 Duplicates:
Batch-convert files for encoding or line ending under Windows
App to convert from ANSI to UTF8 on windows

Hi,

currently i'm in need of a way to convert loads of .txt files in ANSI to UTF8, since i just found out that a app i'm making doesnt recognize accents when they are in ANSI.

I've tried cp converter, but it doesnt work... not only the files after converting still appear as ANSI, but it also doesnt recognize the accents, replacing them with a ?, which is basically the problem i have in my app.

share|improve this question

marked as duplicate by quack quixote, Arjan, Diago Feb 25 '10 at 18:32

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.

    
If your outputting to HTML in your app, using the HTML entities will help. –  Macha Feb 25 '10 at 16:24
1  
this question has been asked many times before: superuser.com/questions/16672 .. superuser.com/questions/27060 .. superuser.com/questions/45148 .. superuser.com/questions/69091 .. –  quack quixote Feb 25 '10 at 18:08
add comment

1 Answer

with powershell you can do something like this:

%  get-content IN.txt | out-file -encoding ENC -filepath OUT.txt

while ENC is something like unicode, ascii, utf8, utf32. checkout 'help out-file'.

to convert all the *.txt files in a directory to utf8 do something like this:

% foreach($i in ls -name DIR/*.txt) { get-content DIR/$i | out-file -encoding utf8 -filepath DIR2/$i }

which creates a converted version of each .txt file in DIR2.

share|improve this answer
    
this is a good answer (afaik, i'm not a powershell user) and i don't think it's been posted on any of the related/similar questions. if you would, please post it as an answer to the master question: superuser.com/questions/27060 ... thanks! –  quack quixote Feb 25 '10 at 19:18
    
consider it done :) –  akira Feb 26 '10 at 6:32
add comment