-
Notifications
You must be signed in to change notification settings - Fork 5
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
UnicodeDecodeError when presenting an object with non-ASCII characters in title #6
Comments
Looks like this is an issue with Archetypes tag() We pass image in as is and do nothing for it. Archetypes should be able to handle it what we throw at it. |
Using pdb with a breakpoint in the method tag() of ImageField class in Archetype's Field.py, to print values and title before the the exception
got
Curiously (?), doing a similar assignment with a similar format applied to that utf-8 title, also in a dict, but OUTSIDE tag(), in the caller, results in no exception... |
You cannot repeat unicode errors in pdb prompt because your terminal messes the encoding for you |
miohtama: I'm aware the terminal messes with what I see, tried to see what was in strings, checked e.g. decoding/reencoding with values['title'].decode('utf-8').encode('utf-8') ... but, of course, not surprising if I'm unaware of subtler effects. |
I forgot to mention that I met a similar problem with redturtle.smartlink [now not installed, failed to report it for that product]. For now I'll probably handle the exception directly inside the tag method in Archetypes' Field.py, using decode('utf-8') to adjust the title when this happens... |
I made a similar fix to plone.app.vocabularies recently: miohtama/plone.app.vocabularies@9864e6b I suggest we apply this to Archetypes? |
Yep, in the service I'm building I ended up just patching Archetypes' Field.py, for now. In the tag method of ImageField I added the following immediately preceding assignment of the values dictionary (used isinstance just in case "type (…) is str" wouldn't cover all needs [but maybe it does])
|
Have you created a patch for Archetypes yet? |
No problems until now with the Archetypes change I already mentioned above:
|
With collective.contentleadimage 1.3.4 in a Plone 4.1.6 site, visiting an object [a link object in the example below] with non-ASCII characters in its title and a lead image leads to a UnicodeDecodeError generating the img tag:
The text was updated successfully, but these errors were encountered: