On Fri, Jan 26, 2018 at 5:27 PM, Steven D'Aprano <steve@pearwood.info> wrote:
tcl/tk and Javascript only support UCS-2 (16 bit) Unicode strings.
Dealing with the Supplementary Unicode Planes have the same problems
that older "narrow" builds of Python sufferred from: single code points
were counted as len(2) instead of len(1), slicing could be wrong, etc.

There are still many applications which assume Latin-1 data. For
instance, I use a media player which displays mojibake when passed
anything outside of Latin-1.

Sometimes it is useful to know in advance when text you pass to another
application is going to run into problems because of the other
application's limitations.

I'm confused -- isn't the way to do this to encode your text into the encoding the other application accepts ?

if you really want to know in advance, it is so hard to run it through a encode/decode sandwich?

Wait -- I can't find UCS-2 in the built-in encodings -- am I dense or is it not there? Shouldn't it be? If only for this reason?

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov