Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4773 closed (worksforme)

UnicodeEncodeError on dropdowns in admin

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


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@…> 8 years ago.

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by sime <simon@…>

comment:1 Changed 8 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by mir@…

  • Component changed from Core framework to Admin interface
  • Resolution set to worksforme
  • Status changed from new to closed

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 Changed 8 years ago by mtredinnick

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