Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Convert ANSI text files to UTF-8

Charles Dye

Super Moderator
May
4,968
128
Staff member
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.)
 
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.
 
Back
Top