views:

330

answers:

4

Does anybody know a tool, preferably for the Explorer context menu, to recursively change the encoding of files in a project from / to UTF-8 and other encodings? Freeware or not too expensive would be great.

Edit: Thanks for the answers, +1 for all of them as they are all fine but I am a lazy bastard sometimes, and would really like to be able to just right click a folder and say "convert all .php files to UTF-8". :) Further suggestions are appreciated.

+2  A: 

I don't know about from the context menu, but notepad++ allows you to change file encodings and it has a macro option... so you could automate the process

Mark
+2  A: 

You could easily achieve something like this using Windows PowerShell. If you got the content for a file you could pipe this to the Out-File cmdlet specifying UTF8 as the encoding.

Try something like:

Get-ChildItem *.txt | ForEach-Object {
$content = $_ | Get-Content

Set-Content -PassThru $_.Fullname $content -Encoding UTF8 -Force}
Alan
+1  A: 

You could write your own in Python by reading the answers to this question about recursing through directories, and this question about converting files to UTF-8.

Dominic Rodger
A: 

@Mark I'm trying to do exactly that, but for some insane reason, stuff you do in the Encoding menu doesn't get saved in macros!

Nathan