I knew UTF-8 and ANSI were not the same. Good to know on the Unicode clarification. Now, back to the original question, is there a simple way to read and use the data or does it require jumping through the hoops as outlined in BP's post?
Jim
Your original post made what was and wasn't understood something of a question mark so thought it best to cover the basics.
BP's post hints at the solution. On the Windows OS UTF-8 is treated as a code page except you can't use it as part of a locale (haven't tried it so not sure about the last part.) If you don't like that, you will have to take up with MSFT. So with WinBatch, you have to briefly change the code page to convert UTF-8 to UTF-16. Once you get to UTF-16, you can use almost any WIL function on your text. For example,
; @true sets file read to convert the contents to Unicode (UTF-16).
hFile = FileOpen("c:\temp\utf-8Test.txt","read",@true)
; Set the code page to UTF-8.
nPrevCP = ChrSetCodepage(65001)
strUni = FileRead(hFile)
FileClose(hFile)
; Set the code page back to(in my case) Windows-1252
; which is also referred to as ANSI but that is a
; relatively harmless misnomer.
ChrSetCodepage(nPrevCP)
Message("UTF-8 Contents as UTF-16", strUni)
exit
You don't need to call ChrSetCodepage before every call to FileRead. Just make sure you avoid any processing that may perform ANSI to Unicode conversion before you set the code page back to the default.