1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Convert ANSI text files to UTF-8

Discussion in 'T&T - TPIPE' started by Charles Dye, Nov 26, 2012.

  1. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,288
    Likes Received:
    39
    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.)
     
  2. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    238
    Likes Received:
    3
    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.
     

Share This Page