Ticket #1943 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

[PATCH] __init__.py admi18n encodes utf-8 twice

Reported by: jbinney Assigned to: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: Toolbox.admi18n Version: 1.0.5
Severity: major Keywords: admi18n translate UnicodeDecodeError
Cc:

Description

The init.py script in <turbogears>/toolbox/admi18n/ calls the google_translate function, which already returns type unicode, and then encodes the unicode again in utf-8. When it passes the text to the catalog.py update function, it appears to be of type str, while it's really a double-encoded unicode. This causes the save function to fail if the text contains any non-ASCII characters. In my patch, I simply remove the unnecessary second utf-8 encode from init.py.

Attachments

__init__.patch (414 bytes) - added by jbinney on 08/18/08 14:12:03.

Change History

08/18/08 14:12:03 changed by jbinney

  • attachment __init__.patch added.

08/19/08 16:44:53 changed by kskuhlman

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

Looks good. Applied in r5167. Thanks for the patch!