How do I convert a string to UCS-2

I need to write a string out to a file the same as it shows up in the FAT tables, ie UCS-2.


For example: "Abrázame.txt"


00000000`0029fdd8 0041 0062 0072 00e1 007a 0061 006d 0065
00000000`0029fde8 002e 0074 0078 0074 0000 0074 0000 0000


But when I UTF16LE it I get:


00000000`0029fad8 0041 0062 0072 0061 0301 007a 0061 006d
00000000`0029fae8 0065 002e 0074 0078 0074 0000 0000 0000


Text Encoding Converter with kTextEncodingISO10646_1993 as the output text encoding fails with -8738 (kTextUnsupportedEncodingErr).


Obviously the OS can do this, as it can read and write those same FAT tables.

Accepted Reply

TEC will in fact do it if you do it properly.

Replies

The text in question which got converted to asterisks was Abråzame.txt.
Well, the first lower case 'a' has an accent over it.

TEC will in fact do it if you do it properly.