Logging \u2083 as cp1252 UnicodeEncodeError in Python 3.4

92 views
Skip to first unread message

Mike Dewhirst

unread,
Nov 24, 2014, 6:14:55 PM11/24/14
to django...@googlegroups.com
Somehow recently the character causing the logging problem is one of
many which are working well in the browser. They are unicode subscripted
numbers for example, \u2083 is subscripted "3".

But in logging under Python 3.4 it causes

--- Logging error ---
Traceback (most recent call last):
File "C:\Python34\Lib\logging\__init__.py", line 980, in emit
stream.write(msg)
File "C:\Users\mike\env\xxdx3\lib\encodings\cp1252.py", line 19, in
encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position
287-288: character maps to <undefined>

<stack trace omitted>

I assume this is because I'm running the Django dev server on Windows 8.1

I have reviewed the Python logging docs and seen no reference to code
pages or even unicode.

There is no logging error when switching to Python 2.7

Is there anything I can do to rein this in?

Thanks

Mike

Reply all
Reply to author
Forward
0 new messages