WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Strings

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Convert UCS-2 Little Endian to Ascii

 Keywords: Convert UCS-2 UCS2 UTF 16 UTF16 UTF16LE Little Endian Ascii 

Question:

Do you have any idea how I can convert an input file encoded as UCS-2 Little Endian to standard one byte US Ascii?

Answer:

I believe the older UCS-2 is a similar character encoding that was superseded by UTF-16.

In WinBatch, the definition of a "Unicode" string is that it contains UTF16-LE (little endian) encoded Unicode characters.

You can probably use the FileGetW function to read the UCS-2 Little Endian file into a Unicode string, then use the ChrUnicodeToString function to convert the Unicode string to an ANSI string, which can then be written out using FilePut.


Article ID:   W18287
Filename:   Convert UCS-2 Little Endian to Ascii.txt
File Created: 2014:03:28:09:10:12
Last Updated: 2014:03:28:09:10:12