Support unicode string in testbrowser

Bug #71960 reported by Francis J. Lacoste
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
BlueBream
New
Undecided
Unassigned
Launchpad itself
Won't Fix
Low
Unassigned
Zope 3
Won't Fix
Undecided
Unassigned
zope.testbrowser
Invalid
Low
Unassigned

Bug Description

Currently, if we want to upload a form containing non-ASCII characters we have to take care of the encoding ourselves. We should be able to just put an unicode string in and let the ClientForm library takes care of the encoding (taking care of uploading in the same charset than the page).

For example, the following will fail with an unicode error:

    >>> browser.getControl('title).value = u'Un problème'
    >>> browser.getControl('Continue').click()

The workaround is to call .encode('utf-8'):

    >>> browser.getControl('title).value = u'Un problème'.encode('utf-8')
    >>> browser.getControl('Continue').click()

Changed in launchpad:
status: Unconfirmed → Confirmed
Changed in launchpad:
importance: Undecided → Low
Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Tres Seaver (tseaver)
Changed in zope.testbrowser:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Curtis Hovey (sinzui) wrote :

This hack is probably outdated, but is illustrates one possible solution.

zope.testing merge.doctest:1486
  sys.stdout = self._fakeout
Becomes
  from codecs import EncodedFile
  sys.stdout = EncodedFile(self._fakeout, "ascii", "utf-8")

Curtis Hovey (sinzui)
Changed in launchpad:
status: Triaged → Won't Fix
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.testbrowser 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/zope.testbrowser.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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