-1

I am having trouble with this unicode error that seems to appear in CMD, but not in IDLE and it's just driving me nuts.

Here is this line that I took out of my body of code:

print u"\u0177" + "is a unicode."

while trying to run my code and any other similar codes with the unicode in it I get this unicode error ;(. Overall goal is to print out a unicode symbol!

Error: UnicodeEncodeError: 'cp932' codec can't encode character u'\u0177' in position 41: illegal multibyte sequence

Ray
  • 95
  • 1
  • 1
  • 7
  • possible duplicate of [Python, Unicode, and the Windows console](http://stackoverflow.com/questions/5419/python-unicode-and-the-windows-console) – tripleee Jun 17 '14 at 09:26

1 Answers1

0

Windows console doesn't support Unicode. Period.

You may try using Cygwin, but then you may have to set up the codepage in your python application.

Codepage for standard output can be read from sys.stdout.encoding and can be set (among others) using PYTHONIOENCODING system variable, but setting it to something else than the actual codepage supported by the console makes little sense.

Also, you should have no problems in Linux and MacOSX, as their consoles are UTF-8.

Karol S
  • 8,353
  • 2
  • 28
  • 43