Answer the question
In order to leave comments, you need to log in
How to set PYTHONIOENCODING to get readable unicode text in cmd.exe?
Python 2.7.2, Windows 7, cmd.exe.
There is a string <type 'unicode'>. When you print it, the exception naturally falls out to the console. My actions:
SET PYTHONIOENCODING=windows-1251
The line is printed out, but in this form: "yayusyryufrёshЄ№ rtёyuёr" - that is, 866 is read as 1251 (or vice versa).
SET PYTHONIOENCODING=cp866 Exception
again.
SET PYTHONIOENCODING=utf-8
I get ╨Ъ╨╛╨╝╨┐╨╛╨╖╨╕╤В╨╛╤А╤L
Question: how to get readable text in the console? Preferably without iconv.
Answer the question
In order to leave comments, you need to log in
Do you fundamentally need a Windows console? And then put cygwin, there is a console in the kit, with settings, including encodings.
I will add to the above that a lot depends on whether dotted fonts were set in the console:
If yes, then outputting text outside the character range of a single-byte encoding of such a font is not possible in any case, even if you use unicode and the console itself with the
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question