print u"\u0432": why is this so hard? UnciodeEncodeError

Michael Hudson mwh at python.net
Mon Apr 12 06:05:02 EDT 2004


"Martin v. Löwis" <martin at v.loewis.de> writes:

> Michael Hudson wrote:
> > The user can set it per-terminal, at runtime, with no notification to
> > the running process that it has done so!
> 
> I would find it acceptable to say "don't do that, then", here. However,
> changing the encoding should be visible to new programs running in the
> terminal.
> 
> I wonder how much would break if Python would assume the terminal
> encoding is UTF-8 on Darwin. Do people use different terminal
> encodings?

How long is a piece of string?  *I* don't change the encoding very often.

You could consider the output of 'defaults read com.apple.Terminal
StringEncoding' or equivalent API calls but it's fairly opaque (it's
'4' on my machine).

I don't think $__CF_USER_TEXT_ENCODING has anything to do with
terminals (CoreFoundation, more likely).

Cheers,
mwh

-- 
[1]For those of you who aren't aware "tossing" is a euphamism for,
   well, vigourously rubbing your love pole. You understand?
   Flogging the dolphin.  Stretching the chicken's neck. Waving your
   magic wand.  Basically, wanking.  -- Just another Morfans SDA update



More information about the Python-list mailing list