Convert ANSI text files to UTF-8

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,689
106
Albuquerque, NM
prospero.unm.edu
Code:
for %f in ( *.txt ) tpipe /input="%f" /output="%@name[%f].utf8" /unicode=ansi,utf-8 /string=1,0,\xef\xbb\xbf

This example adds a UTF-8 byte order mark. If you don't want the BOM, omit the /STRING= option. (The last argument to /STRING appears to be a string of bytes, not characters. If you use the intuitive \xFEFF, you'll get gribble at the start of the file.)
 
Feb 23, 2012
240
3
This example adds a UTF-8 byte order mark. If you don't want the BOM, omit the /STRING= option. (The last argument to /STRING appears to be a string of bytes, not characters. If you use the intuitive \xFEFF, you'll get gribble at the start of the file.)

Great stuff! Thanks for posting, Charles. The BOM issue is always a delicate one with UTF-8, and it's good to learn that with TPIPE we can keep it under control.