Assuming an exception like:
x = ValueError(u'\x f8')
AFAIK the common way to get a string representation of the exception
as a message is to simply cast it to a string: str(x). This will
result in an "UnicodeErr or: ASCII encoding error: ordinal not in
range(128)".
The common way to fix this is with something like
u'\xf8'.encode( "ascii", 'replace'). However I can't find any way to
tell ValueErrors __str__ method which encoding to use.
Is it possible to solve this without using sys.setdefaulte ncoding()
from sitecustomize?
Regards,
Rune Frøysa
x = ValueError(u'\x f8')
AFAIK the common way to get a string representation of the exception
as a message is to simply cast it to a string: str(x). This will
result in an "UnicodeErr or: ASCII encoding error: ordinal not in
range(128)".
The common way to fix this is with something like
u'\xf8'.encode( "ascii", 'replace'). However I can't find any way to
tell ValueErrors __str__ method which encoding to use.
Is it possible to solve this without using sys.setdefaulte ncoding()
from sitecustomize?
Regards,
Rune Frøysa
Comment