#39 — UnicodeEncodeError in Plone2.1.3
by
rsantos
—
last modified
Jul 09, 2009 03:39 PM
| State | Resolved |
|---|---|
| Version: | |
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | rsantos |
| Submitted on | Jun 05, 2006 |
| Responsible |
—
|
| Target release: |
I'm getting a unicode error with Plone-2.1.3 and LinguaPlone0.9-beta. The problem seems to be related to global_languageselector.pt. The complete traceback follows:
Traceback (innermost last):
Module ZPublisher.Publish, line 113, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 40, in call_object
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 195, in _exec
Module Products.CacheSetup.patch_cmf, line 14, in FSPT_pt_render
Module Products.CacheSetup.patch_utils, line 9, in call_pattern
Module Products.CMFCore.FSPageTemplate, line 134, in pt_render
Module Products.CacheSetup.patch_cmf, line 52, in PT_pt_render
Module Products.CacheSetup.patch_utils, line 9, in call_pattern
Module Products.PageTemplates.PageTemplate, line 104, in pt_render
- <FSPageTemplate at /site/document_view used for /site/front-page>
Module TAL.TALInterpreter, line 206, in __call__
Module TAL.TALInterpreter, line 250, in interpret
Module Products.CacheSetup.patch_interpreter, line 79, in do_useMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 742, in do_defineSlot
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 690, in do_defineMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 734, in do_defineSlot
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 690, in do_defineMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module Products.CacheSetup.patch_interpreter, line 79, in do_useMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 677, in do_condition
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 426, in do_optTag_tal
Module TAL.TALInterpreter, line 411, in do_optTag
Module TAL.TALInterpreter, line 406, in no_tag
Module TAL.TALInterpreter, line 250, in interpret
Module Products.CacheSetup.patch_interpreter, line 79, in do_useMacro
Module TAL.TALInterpreter, line 250, in interpret
Module TAL.TALInterpreter, line 477, in do_setLocal_tal
Module Products.PageTemplates.TALES, line 221, in evaluate
- URL: file:LinguaPlone/skins/LinguaPlone/global_languageselector.pt
- Line 35, Column 6
- Expression: standard:'context/languageSelectorData'
- Names:
{'container': <PloneSite at /site>,
'context': <ATDocument at /site/front-page>,
'default': <Products.PageTemplates.TALES.Default instance at 0xb759d68c>,
'here': <ATDocument at /site/front-page>,
'loop': <Products.PageTemplates.TALES.SafeMapping object at 0xb18f106c>,
'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0xb75ab58c>,
'nothing': None,
'options': {'args': ()},
'repeat': <Products.PageTemplates.TALES.SafeMapping object at 0xb18f106c>,
'request': <HTTPRequest, URL=http://localhost:18000/site/front-page/document_view>,
'root': <Application at >,
'template': <FSPageTemplate at /site/document_view used for /site/front-page>,
'traverse_subpath': [],
'user': admin}
Module Products.PageTemplates.Expressions, line 185, in __call__
Module Products.PageTemplates.Expressions, line 180, in _eval
Module Products.PageTemplates.Expressions, line 77, in render
Module Products.PageTemplates.ZRPythonExpr, line 76, in call_with_ns
Module Products.CMFCore.FSPythonScript, line 103, in __render_with_namespace__
Module Shared.DC.Scripts.Bindings, line 325, in __render_with_namespace__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 16, in languageSelectorData
- <FSPythonScript at /site/languageSelectorData used for /site/front-page>
- Line 16
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 18, in translate
- <FSPythonScript at /site/translate used for /site/front-page>
- Line 18
Module Products.CMFCore.FSPythonScript, line 108, in __call__
Module Shared.DC.Scripts.Bindings, line 311, in __call__
Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec
Module Products.CMFCore.FSPythonScript, line 164, in _exec
Module None, line 14, in utranslate
- <FSPythonScript at /site/utranslate used for /site/front-page>
- Line 14
Module Products.CMFPlone.TranslationServiceTool, line 35, in utranslate
Module Products.CMFPlone.i18nl10n, line 53, in utranslate
Module Products.PlacelessTranslationService.PlacelessTranslationService, line 104, in utranslate
Module Products.PlacelessTranslationService.PlacelessTranslationService, line 515, in utranslate
Module Products.PlacelessTranslationService.PlacelessTranslationService, line 553, in translate
Module Products.PlacelessTranslationService.PlacelessTranslationService, line 596, in interpolate
UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in position 7: ordinal not in range(128)
- Steps to reproduce:
- Create a new Plone site.
Install LinguaPlone.
Go to language settings and add a new language to the available languages (e.g. PT).
Set PT as the default language.
Go to the portal front-page and click in the english flag.
Added by
Paolo Melchiorre
on
Jun 09, 2006 07:46 AM
I've the same error with italian and english language.
Target release:
0.9
→
None
This is my Plone version overview:
Plone 2.1.3,
Zope (Zope 2.8.6-final, python 2.3.5, linux2),
Python 2.3.5 (#2, Feb 2 2006, 18:22:25) [GCC 4.0.3 20060115 (prerelease) (Ubuntu 4.0.2-7ubuntu1)],
PIL 1.1.5
LinguaPlone 0.9.0 Beta - r4895
The traceback is on attachment.
PauLoX
Added by
(anonymous)
on
Jun 09, 2006 09:16 AM
Could you try UnicodeErrorDetector from the collective to see if you're able to pinpoint where the unicode leaks through?svn co https://svn.plone.org/[…]/trunk UnicodeErrorDetector
Turn it on in config.py and restart.
Added by
Janne Toivola
on
Jun 10, 2006 12:03 PM
The same thing happens with English and Arabic. Worked fine with 2.1.2.
Added by
Alex Limi
on
Jun 12, 2006 08:04 AM
Try downgrading to the PloneLanguageTool version included in Plone 2.1.2 in the meantime, and see if that fixes it (give feedback if it does or doesn't).
Issue state:
unconfirmed
→
open
Target release:
None
→
0.9
Added by
Paolo Melchiorre
on
Jun 12, 2006 04:33 PM
Downgrading PloneLanguageTool from 1.0 to 0.9 (from Plone 2.1.2) fix this issue form me.Plone version overview
Plone 2.1.3,
Zope (Zope 2.8.6-final, python 2.3.5, linux2),
Python 2.3.5 (#2, Feb 2 2006, 18:22:25) [GCC 4.0.3 20060115 (prerelease) (Ubuntu 4.0.2-7ubuntu1)],
PIL 1.1.5
LinguaPlone (Revision 10043) http://svn.plone.org/svn/plone/LinguaPlone/trunk/
PauLoX
Added by
rsantos
on
Jun 13, 2006 03:21 PM
Downgrading PloneLanguageTool, from 1.0 to 0.9, didn't solve the problem to me. I can avoid the error by switching the layer order in portal_skins, putting LanguageTool in front of LinguaPlone, so it will be use the global_languageselector.pt version from LanguageTool.I think the problem is in script languageSelectorData.py (used by global_languageselector.pt from LinguaPlone). It is trying to translate the text "Switch language to ${language}" with mapping={'language': name}, but somehow the variable 'name' is unicode. PlacelessTranslationService (at least version 1.3.1) assumes mapping values are in the same encoding as the text to translate, so it raises the error.
I solved the problem (at least for me :)) with this simple change in script languageSelectorData.py:
alt = context.translate(msgid='label_switch_language_to',
- default='Switch language to ${language}',
+ default=u'Switch language to ${language}',
mapping={'language': name},
domain='linguaplone')
Added by
Encolpe Degoute
on
Jun 16, 2006 03:49 PM
The last proposition was the good one.
Issue state:
postponed
→
in-progress
It's fixed now in the SVN for Plone 2.1.2 and Plone 2.1.3:
http://dev.plone.org/plone/changeset/10069
No responses can be added.
If you can, please log in before submitting a reaction.

