Python 2.7.2+ (default, Oct 4 2011, 20:03:08) [GCC 4.6.1] on linux2 Type "copyright", "credits" or "license()" for more information. >>> import sys >>> import locale >>> sys.getdefaultencoding() 'ascii' >>> locale.getpreferredencoding() 'UTF-8' >>> s = u'Русский текст' >>> print s.encode('utf_8') Ð ÑÑÑкий ÑекÑÑ >>> print s.encode('latin1') Русский текст
откуда latin1? попробовал совсем случайно… поидее в utf_8 кодировке должен поступать текст из IDLE.
причем из консоли все ОК:
>>> import sys >>> import locale >>> sys.getdefaultencoding() 'ascii' >>> locale.getpreferredencoding() 'UTF-8' >>> s = u'Русский текст' >>> print s.encode('utf_8') Русский текст
P.S. Ubuntu 11.10