#!/usr/bin/python # -*- coding: utf-8 -*- import locale, sys print 'locale.getpreferredencoding()', locale.getpreferredencoding() print 'sys.stdout.encoding', sys.stdout.encoding print unicode("Привет","utf-8").encode(sys.stdout.encoding) # MS-DOS console, cp866 # C:\Python27\python.exe hello.py # locale.getpreferredencoding() cp1251 # sys.stdout.encoding None # Привет