Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

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 History

10/13/05 11:36:46: Modified by mdt@emdete.de

change cherrypy/lib/filter/encodingfilter.py line 58

yield line.encode(enc) to yield line.encode(enc, conf('encodingFilter.encode.errors', 'strict'))

that's all :D perhaps add to doc that this var may be set to ignore, replace or xmlcharrefreplace.

05/02/06 17:12:56: Modified by fumanchu

  • status changed from new to closed.
  • resolution set to fixed.

Implemented in [1087].

12/09/06 12:31:39: Modified by fumanchu

Fixed in 2.x in [1480].

Hosted by WebFaction

Log in as guest/cpguest to create tickets