braver wrote: > I'm storing 8-bit characters from the 128-256 range in Python > strings. They are Windows CP1251 Russian characters. When looking at > those strings in the Python interpreter, they come up as codes inside > the string. How can I teach Python to show those 8-bit characters in > the native encoding of the terminal -- in the current locale -- where > the interpreter was started?
The python-interpreter will print them out using hex because it calls repr(string) - to prevent any encoding-related troubles. But printing them will meet your expectations. See below: Python 2.5.1 (r251:54863, May 2 2007, 16:56:35) >>> s = 'äöüßÄÜ' >>> s '\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x9f\xc3\x84\xc3\x9c' >>> print s äöüßÄÜ >>> Diez -- http://mail.python.org/mailman/listinfo/python-list