#6 — UnicodeEncodeError

by Max Bloechle last modified Jun 09, 2009 11:23 PM
State Resolved
Version: 2.1
Area Functionality
Issue type Bug
Severity Medium
Submitted by Max Bloechle
Submitted on Jun 02, 2009
Responsible Maurits van Rees
Target release:
Hi, entering an Umlaut in @@reb-controlpanel and trying to edit an real estate throws an error "'ascii' codec can't encode character u'\xd6' in position 0: ordinal not in range(128)". I have come accross the UnicodeQuickFix, but I am not sure if this is the right way to go. Any hints? Thank you!
Added by Max Bloechle on Jun 02, 2009 09:22 AM
It looks similar to
http://plone.org/products/plonehelpcenter/issues/79
Added by Maurits van Rees on Jun 08, 2009 09:28 PM
Hello Max,

In which field are you adding that Umlaut? In the cities field I changed Paris into Päris and I could still edit a real estate.

What is the default charset of your Plone Site? See the default_charset property in portal_properties/site_properties. Should be utf-8 usually.

Can you post the complete traceback you get?
Added by Max Bloechle on Jun 09, 2009 01:10 PM
Hi Maurits,

sorry I wasn't clear, I was assuming it applies to all the fields, however I was wrong. Adding an Umlaut to the cities field works fine but not for example the "Heating" field.

The default_charset property in plone is set to utf-8 (the default) and python is set to ascii:
>>> import sys
>>> sys.getdefaultencoding()
'ascii'

Please find attached the traceback. Thank you!
Attached:
traceback.txt — text/plain, 8 Kb
Added by Maurits van Rees on Jun 09, 2009 11:23 PM
Issue state: UnconfirmedResolved
Responsible manager: (UNASSIGNED)maurits
Ah, so this goes wrong in browser/vocabularies.py. In the CityVocabularyFactory in that file we use an own unicode_vocabulary instead of the default SimpleVocabulary. For some reason we do not do that in most of the other vocabularies there. Since I can indeed not think of a reason for that I changed the code to use the unicode_vocabulary in all vocabularies.

Fixed in r87803 on trunk. Can you test that code? Hm, I might as well just release a new versions on the python package index. Done: http://pypi.python.org/pypi/collective.realestatebroker/2.2

No responses can be added.