> I'm trying to output a string of characters as 16-bit unicode.  If they
> were all ascii, I'd do this for each one:
>
> print MYFILE pack("n", ord($my_chr));
>
> The analogous line with unicode text is
>
> print MYFILE pack("W", ord($my_chr));
>
> but that gets me utf-8 text: one byte for 7-bit ascii characters and
> two for most others.  I want utf-16, not utf-8, each char exactly 16
> bits, but modifying the outfile screws everything up, e.g.
>
> open MYFILE, ">:encoding(utf-16)", "$filepath";

my quick reading shows that maybe you need UTF-16?  but the other issue 
might be endianness.  so try UTF-16BE or UTF-16LE to see if that gives 
what you want.  or maybe you really mean UCS-2BE/LE?  UTF-16 can actually 
give 4 bytes for certain characters.
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to