Nicholas Clark wrote:
    return pack('C*', unpack('n*', $sTxt));

No. That's not a valid way to convert ucs2 text to anything, let alone
ISO-8859-1

Urge
To
Kill
Rising

[It's converting network order 16 bit values into a list of numbers, then
converting that list to 8 bit characters, with an implicit truncation]

Nicholas Clark

I ran into problems with UCS2 a couple weeks ago. I exported some data from MS SQL into a CSV file, which I then read from a scripting language (R, a statistical language) to do some stuff. R doesn't know how to read UCS2, which is hateful (since there's a Windows binary of it, you would think it would know how). Anyway, I ended up just doing the conversion with vim (using the fenc option), since it was a one-shot deal.

That isn't really all that relevant to your hate, but I feel your pain nonetheless.

Jeremy

--
Jeremy Stephens      Computer Systems Analyst I    School of Medicine
                    Department of Biostatistics   Vanderbilt University

Reply via email to