Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding problems with Mockup Select2 widget #650

Closed
thet opened this issue Jun 25, 2015 · 3 comments
Closed

Encoding problems with Mockup Select2 widget #650

thet opened this issue Jun 25, 2015 · 3 comments

Comments

@thet
Copy link
Member

thet commented Jun 25, 2015

With plone.app.widgets under Plone 4.3 or the standard Plone 5 installation, the following problem occurs when choosing a value with non-ASCII characters from the vocabulary result presented by the Select 2 widget:

  • Edit a content item, go to the categorization tag, save a new category with non-ASCII data in it (e.g. "Nåøï"). Click Save.
  • Open the Edit view again. Go to the categorization tab. No surprises until now.
  • Delete the item from the Select2 widget and select the item from the list again. Or any other item with non-ASCII characters in it. Click Save.

The Subject tag is presented with binary encoded data. That's because the vocabularies token attribute saves it with the binascii.b2a_qp function, while value and title are just stored as unicode values.
The @@getVocabulary from plone.app.widgets.browser.vocabularies, resp Plone 5, plone.app.content.browser.vocabularies uses the token instead of the value.

Two pull requests fixing it are underway.

@thet thet modified the milestones: Plone 4.3, Plone 5 Jun 25, 2015
thet added a commit to plone/plone.app.widgets that referenced this issue Jun 25, 2015
…n for the id in the result set. The token is binary encoded and leads to encoding errors when selecting a value with non-ASCII data from vocabulary list in a select2 based widget. Fixes: plone/Products.CMFPlone#650
thet added a commit to plone/plone.app.content that referenced this issue Jun 25, 2015
…n for the id in the result set. The token is binary encoded and leads to encoding errors when selecting a value with non-ASCII data from vocabulary list in a select2 based widget. Fixes: plone/Products.CMFPlone#650
thet added a commit to plone/buildout.coredev that referenced this issue Jun 25, 2015
Branch: refs/heads/master
Date: 2015-06-25T03:10:04+02:00
Author: Johannes Raggam (thet) <raggam-nl@adm.at>
Commit: plone/plone.app.content@9927a52

Let @@getVocabulary return the vocabulary's value instead of the token for the id in the result set. The token is binary encoded and leads to encoding errors when selecting a value with non-ASCII data from vocabulary list in a select2 based widget.  Fixes: plone/Products.CMFPlone#650

Files changed:
M CHANGES.rst
M plone/app/content/browser/vocabulary.py
M plone/app/content/tests/test_widgets.py
Repository: plone.app.content
Branch: refs/heads/master
Date: 2015-06-25T10:57:01+02:00
Author: Johannes Raggam (thet) <raggam-nl@adm.at>
Commit: plone/plone.app.content@62bbf28

Merge pull request #34 from plone/thet-vocabularyencoding

Fix encoding problems with Mockup Select2 widget

Files changed:
M CHANGES.rst
M plone/app/content/browser/vocabulary.py
M plone/app/content/tests/test_widgets.py
@thet
Copy link
Member Author

thet commented Jun 25, 2015

Closed via plone/plone.app.content#34

@thet thet closed this as completed Jun 25, 2015
@davisagli
Copy link
Member

I don't think that fix is correct. It's appropriate for forms to deal with tokens. It sounds like maybe we're missing a widget converter to turn the token back into the corresponding value on the backend when the form is submitted.

thet added a commit to plone/plone.app.z3cform that referenced this issue Nov 24, 2015
Fix ``AjaxSelectWidgetConverter`` to decode quoted-printable encoded ascii
strings back to unicode. The Select2 based AjaxSelectWidget returned the ids
which are vocabulary tokens instead of the text. Fixes messed up characters
when selecting tags with non-ASCII characters. Fixes:
plone/Products.CMFPlone#650 - makes obsolete: plone/plone.app.content#34
thet added a commit to plone/plone.app.content that referenced this issue Nov 24, 2015
…the token for the id in the result set. The token is binary encoded and leads to encoding errors when selecting a value with non-ASCII data from vocabulary list in a select2 based widget. Fixes: plone/Products.CMFPlone#650"

This reverts commit 9927a52.
@thet
Copy link
Member Author

thet commented Nov 24, 2015

Hope this fixes it: plone/plone.app.z3cform#34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants