R
Rune Froysa
Assuming an exception like:
x = ValueError(u'\xf8')
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 "UnicodeError: 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.setdefaultencoding()
from sitecustomize?
Regards,
Rune Frøysa
x = ValueError(u'\xf8')
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 "UnicodeError: 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.setdefaultencoding()
from sitecustomize?
Regards,
Rune Frøysa