Changes between Initial Version and Version 1 of Ticket #5640


Ignore:
Timestamp:
Sep 29, 2007, 7:55:15 AM (17 years ago)
Author:
Malcolm Tredinnick
Comment:

Hiding genuine errors is not the solution here, so this patch can't go in. Porting an application is a one-time job, so I'm reluctant to even add a setting for this.

The solution is probably to write your own version of force_unicode and assign that to encoding.force_unicode during your porting phase. We might be able to make the error a bit more self-helpful, though.

Changing the title to reflect the real issue, since force_unicode should raise UnicodeDecodeError when there's a problem. That's not a bug; the data it's being given is invalid.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5640

    • Property Has patch unset
    • Property Owner changed from nobody to Malcolm Tredinnick
    • Property Triage Stage UnreviewedDesign decision needed
    • Property Summary utils.encoding.force_unicode should never throw UnicodeDecodeErrorRequest to improve error handling in utils.encoding.force_unicode.
  • Ticket #5640 – Description

    initial v1  
    11migrating a large django project to trunk version > 5609 (i.e. after Unicode branch was merged) can be very painful due to a bug(?!) in utils.encoding.force_unicode
    22
    3 basically, following the instructions here http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist is the right thing to do, but it is very difficult in a larger project to catch all the strings that might need and u'' before them.
     3basically, following the instructions here http://code.djangoproject.com/wiki/UnicodeBranch#PortingApplicationsTheQuickChecklist is the right thing to do, but it is very difficult in a larger project to catch all the strings that might need and {{{u''}}} before them.
    44
    55Make the slightest oversight, and you lose the ability to debug your models/views/templates as utils.encoding.force_unicode will throw an UnicodeDecodeError exception like this one:
Back to Top