Five.browser.decode.processInputs and ZTUtils.Zope.make_query collide because of non-ASCII characters

Bug #160979 reported by Daniel Nouri
6
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Low
Unassigned

Bug Description

When Five.browser.decode.processInputs decodes values, it's no longer safe for ZTUtils.Zope.make_query to do this:

    qlist[i] = '%s%s=%s' % (uq(k), m, uq(str(v)))

Obviously, str(v) will pretty quickly result in a UnicodeError. To find out the appropriate encoding, one has to probably go back to negotiating the charset.

Andreas Jung (ajung)
Changed in zope2:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
G. Gozadinos (ggozadinos) wrote :

This affects a number of sites I am running which use Greek as a language in utf-8 encoding.
I temporarily fix this by adding:

if isinstance(v, unicode):
 v = v.encode('utf-8')

before qlist[i] = '%s%s=%s' % (uq(k), m, uq(str(v))) is called.
Supposedly one should use IUserPreferredCharsets utility to get the encoding and modify the above accordingly.
I assume that all multilingual plone sites will be affected by this.

Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.