How to convert character encodings on Windows?

5

1

I'm trying to work out how to convert a file to UTF-8, but I really can't find much useful info on google other than to use iconv. I downloaded that, but when I ran it via the CLI it told me that I hadn't installed it properly. The file I'm trying to handle is a rather large file (5M lines).

Brett

Posted 2011-05-30T15:13:01.190

Reputation: 761

Answers

5

Notepad++ provides an easy (manual) way to do it. Open your file, choose "Encoding > Convert to UTF-8", and save. I think the size limit is 2 GB.

user775598

Posted 2011-05-30T15:13:01.190

Reputation: 426

Ok, I just tried this but it choked on a 889MB file & I've read other reports that it couldn't even open much smaller files & hence I'm still looking. :( – Brett – 2011-05-30T19:40:20.517

Nope.... first one said "error" when I tred to run my file & didn't say why & second one I really don't think it's a good idea to paste 5M lines into a web form. ;) – Brett – 2011-05-30T21:15:27.727

Keep Googling? Here's another one: http://sourceforge.net/projects/iconvnet/

– user775598 – 2011-05-30T21:18:12.237

I'll try that... but yes, I have been looking. Tried another but seemed like it loaded the file into memory or something as Windows had to increase the size of my paging file & closing all my programs to reboot took forever. – Brett – 2011-05-30T21:31:47.920

Well I tried it but it lacks documentation on how to use it. – Brett – 2011-05-30T21:50:48.237

4

Well, you can just use iconv. You can for example download a Setup.exe from GnuWin32, that should just work (TM).

Also see the question Batch-convert files for encoding or line ending which describes how to convert using the command line on Windows.

sleske

Posted 2011-05-30T15:13:01.190

Reputation: 19 887

libintl.dll can be found here: http://gnuwin32.sourceforge.net/packages/libintl.htm, just put libintl.dll into the same directory as iconv.exe. – Ben – 2014-08-29T18:05:34.880

No matter what I do I cannot seem to get iconv working & it keeps complaining about needing intl.dll – Brett – 2011-05-30T19:42:48.957

1

One option is to download Cygwin. Cygwin lets you use the Linux command line from within Windows. One advantage of using Cygwin is you don't have to worry about adding a program to the PATH as you would if you used the Windows command line. So download Cygwin and be sure to search for and select the iconv tool in your download. Then you can follow the example at this StackOverflow question. For instance it says,

iconv -f UTF-8 -t ISO-8859-15 in.txt > out.txt

where UTF-8 is the starting encoding of in.txt and ISO-8859-15 is the output you'd like out.txt to be.

Max

Posted 2011-05-30T15:13:01.190

Reputation: 121