Monday, November 24, 2014

Logging \u2083 as cp1252 UnicodeEncodeError in Python 3.4

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5473BBD3.8080905%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment