Ticket #328 (enhancement)
Opened 3 years ago
Last modified 2 years ago
UnicodeEncodeError ...
Status: closed (fixed)
| Reported by: | mdt@emdete.de | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | CherryPy code | Keywords: | unicode error encoding |
| Cc: |
using unicode and the encoding filter cp often bails out with error like
UnicodeEncodeError?: 'charmap' codec can't encode character u'\u2013' in position 0: character maps to <undefined>
this is very ugly, i would prefere a more tolerant behavior. this can be achieved by setting the errors parameter in encode() of the unicode object: in cherrypy/lib/filter/encodingfilter.py line 58 i use
yield line.encode(enc, 'replace')
for that. eventually 'xmlcharrefreplace' would be even better, in fact this should probably be configureable...


change cherrypy/lib/filter/encodingfilter.py line 58
that's all :D perhaps add to doc that this var may be set to ignore, replace or xmlcharrefreplace.