Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#4773 closed (worksforme)

UnicodeEncodeError on dropdowns in admin

Reported by: sime <simon@…> Owned by: Adrian Holovaty
Component: contrib.admin Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Running rev 5260. A non-ascii character (British pound sign), being drawn into a drop down seems to have caused a UnicodeEncodeError in force_unicode. I'm not familiar with the recent unicode merge but the patch here has solved my immediate problem.

Attachments (1)

unicode_fix.diff (491 bytes ) - added by sime <simon@…> 17 years ago.

Download all attachments as: .zip

Change History (4)

by sime <simon@…>, 17 years ago

Attachment: unicode_fix.diff added

comment:2 by mir@…, 17 years ago

Component: Core frameworkAdmin interface
Resolution: worksforme
Status: newclosed

Hi Sime, recently, Malcolm merged in a big patch that should solve all the usual unicode problems. Please take a look at the documentation cited in the posting above in this ticket. Can you please try again with an up to date version and reopen if the problem persists? Thanks!

comment:3 by Malcolm Tredinnick, 17 years ago

Since you talk about force_unicode, I'm guessing you mean you are running 5620, not 5260.

This patch doesn't look like the right fix; it's exploiting a slightly ugly feature of smart_str that should only be required for broken code, from memory.

Can you please provide an example of how to repeat the problem so that we can try to work out the right fix. At a minimum, what is str(s) returning when the error occurs (it should be UTF-8, so I'm confused as to why any encoding error would be occurring). And is the 'encoding' parameter anything other than 'utf-8' when the problem occurs?

A traceback would be useful, too.

Note: See TracTickets for help on using tickets.
Back to Top