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.

I need to view large Unicode text files (current version is 2,379,415,348 bytes) on Windows 7.

Normally I prefer UTF-8 but, but after looking on SuperUser it seems the best Windows large file viewer can't handle UTF-8 so I don't mind doing one-off conversions of these files to UTF-16-LE until a better viewer comes along.

So in the meantime I need a tool that can convert the encoding. Note that I can't use an editor for this or I would just view the file in that editor. Either a command line or GUI tool would be fine.

(I have a netbook maxed out to 2G RAM, sometimes I can view these files fine in gVim but I often have lots of browser windows open and have run out of memory plenty of times. LTFViewer can view text files right from the disk without loading the whole thing into RAM)

share|improve this question
1  
Have you tried Notepad? (Just kidding) –  Mehrdad Aug 3 '11 at 15:02
    
@Mehrdad: Ok you made me laugh d-; –  hippietrail Aug 3 '11 at 15:09

1 Answer 1

up vote 6 down vote accepted

GNU iconv has a Windows version.

iconv -f utf-8 -t utf-16le < in.txt > out.txt
share|improve this answer
    
That commandline seems to have output UTF-16 big endian! (I guess it chose the native format of its native *nix rather than the native format of its current port) –  hippietrail Aug 3 '11 at 15:36
    
@hippietrail: If you require little-endian, specify -t utf-16le. // The "native format" depends on the CPU architecture, not on the OS. (FWIW, iconv chooses little-endian on Linux x86_64.) Most Windows and nix programs can deal with both utf-16be and utf-16le just fine, and iconv even includes the "byte order mark" to help with this. –  grawity Aug 3 '11 at 15:43
    
Sadly, LTFViewer, can only handle UTF-16LE, despite the BOM. I would rubbish it but it seems to be the only free disk-based large file viewer on Windows. By the way I did specifically mention LE in my question but I can never remember whether it's UTF-16LE or UTF-16-LE. I am running an Intel CPU in 32-bit mode. –  hippietrail Aug 3 '11 at 16:16
    
@hippietrail: If you require little-endian, specify -t utf-16le in iconv. –  grawity Aug 3 '11 at 16:19
1  
This is a great answer, but only if you are allowed to install software on the machine in question. Is there no included utility to do this on Windows? –  Noah Aug 22 '13 at 1:37

protected by slhck Apr 24 '12 at 14:16

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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