WTF? Printing unicode strings

skip at pobox.com skip at pobox.com
Fri May 19 19:16:23 CEST 2006


    Robert> Because sys.stdout.encoding isn't determined by your Python
    Robert> configuration, but your terminal's.

Learn something every day.  I take it "646" is an alias for "ascii" (or vice
versa)?

    % python
    Python 2.4.2 (#1, Feb 23 2006, 12:48:31)
    [GCC 3.4.1] on sunos5
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import sys
    >>> sys.stdout.encoding
    '646'
    >>> import codecs
    >>> codecs.lookup("646")
    (<built-in function ascii_encode>, <built-in function ascii_decode>, <class encodings.ascii.StreamReader at 0x819aa4c>, <class encodings.ascii.StreamWriter at 0x819aa1c>)

Skip



More information about the Python-list mailing list