Plone 4.2.5 upgraded from 4.1.4, default_language is zh-cn, default_charset is utf-8 (portal_properties/site_properties).
when I try to rename a Plone site's name in the root page at ip:8080/, a site error is shown:
An error was encountered while publishing this resource.
Error Type: UnicodeDecodeError
Error Value: ('ascii', '\xe8\xa2\x81\xe4\xba\x88\xe6\xb9\x98', 0, 1, 'ordinal not in range(128)')
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module OFS.CopySupport, line 333, in manage_renameObjects
Module OFS.CopySupport, line 369, in manage_renameObject
Module zope.event, line 31, in notify
Module zope.component.event, line 24, in dispatch
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module zope.component.event, line 32, in objectEventNotify
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
Module zope.container.contained, line 153, in dispatchToSublocations
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
Module zope.container.contained, line 153, in dispatchToSublocations
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
Module zope.container.contained, line 153, in dispatchToSublocations
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
Module zope.container.contained, line 153, in dispatchToSublocations
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module OFS.subscribers, line 101, in dispatchObjectWillBeMovedEvent
Module zope.container.contained, line 153, in dispatchToSublocations
Module zope.component._api, line 136, in subscribers
Module zope.component.registry, line 321, in subscribers
Module zope.interface.adapter, line 585, in subscribers
Module Products.CMFCore.CMFCatalogAware, line 271, in handleContentishEvent
Module Products.Archetypes.CatalogMultiplex, line 49, in unindexObject
Module Products.CMFPlone.CatalogTool, line 393, in uncatalog_object
Module Products.ZCatalog.ZCatalog, line 508, in uncatalog_object
Module Products.ZCatalog.Catalog, line 369, in uncatalogObject
Module Products.PluginIndexes.common.UnIndex, line 286, in unindex_object
Module Products.PluginIndexes.common.UnIndex, line 157, in removeForwardIndexEntry
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 0: ordinal not in range(128)
UnicodeDecodeError related problems had ever occurred when I tried to import some folders to a newly created Plone site.
I successfully renamed another Plone site's name. I can not tell what the difference between them is. :(
Your site, at some point, indexed unicode content into the Catalog indexes, effectively breaking them. This may have been due to an old Plone bug, or something an add-on or custom code did wrong.
You can try to run a full reindex with the default Python encoding set to UTF-8 to work around this. The following is not a recommended procedure for production sites; this is just a temporary 'plaster' for your problem.
In your Python site-packages
directory, add a file named sitecustomize.py
with the contents:
import sys
sys.setdefaultencoding('utf8')
then restart your plone site and attempt the rename or do a full catalog reindex first.
Do remember to remove the sitecustomize.py
file again. Setting the default encoding in Python is only going to mask future problems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With