Urgent: zope cvs not accept Chinese any more
I just check out the zope from cvs. Then I receive error when update properties. It seems the property menager now try to re-code into unicode, but thinking the input is just latin-1. Actually, I have just add to the root of my site the property management_page_charset as utf-8 which the manage page correctly default to utf-8 encoding now. But obviously it does not accept chinese. I have also try to add a new property as ustring but also fail. Should I need to add chinese / Japanese encoding to python? the version : Zope Version (unreleased version, python 2.1.2, freebsd4) Python Version 2.1.2 (#1, Mar 8 2002, 19:05:29) [GCC 2.95.3 20010315 (release) [FreeBSD]] System Platform freebsd4 SOFTWARE_HOME /usr/home/zope/Zope/lib/python INSTANCE_HOME /usr/home/zope/InstanceHome CLIENT_HOME /usr/home/zope/InstanceHome/var Process Id 349 (149715968) trace out capture as below: ----- Site Error An error was encountered while publishing this resource. Error Type: UnicodeError Error Value: Latin-1 encoding error: ordinal not in range(256) -------------------------------------------------------------------------------- Troubleshooting Suggestions The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. __________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com
I think this behaviour is caused by Toby unicode patches that were merged into the trunk some time ago. Maybe Toby can give an explanation for this behaviour. Andreas ----- Original Message ----- From: "kent sin" <kentsin@yahoo.com> To: <zope-dev@zope.org> Sent: Saturday, May 04, 2002 00:08 Subject: [Zope-dev] Urgent: zope cvs not accept Chinese any more
I just check out the zope from cvs. Then I receive error when update properties. It seems the property menager now try to re-code into unicode, but thinking the input is just latin-1. Actually, I have just add to the root of my site the property management_page_charset as utf-8 which the manage page correctly default to utf-8 encoding now. But obviously it does not accept chinese. I have also try to add a new property as ustring but also fail.
Should I need to add chinese / Japanese encoding to python?
the version :
Zope Version (unreleased version, python 2.1.2, freebsd4) Python Version 2.1.2 (#1, Mar 8 2002, 19:05:29) [GCC 2.95.3 20010315 (release) [FreeBSD]] System Platform freebsd4 SOFTWARE_HOME /usr/home/zope/Zope/lib/python INSTANCE_HOME /usr/home/zope/InstanceHome CLIENT_HOME /usr/home/zope/InstanceHome/var Process Id 349 (149715968)
trace out capture as below: ----- Site Error An error was encountered while publishing this resource.
Error Type: UnicodeError Error Value: Latin-1 encoding error: ordinal not in range(256)
--------------------------------------------------------------------------
Troubleshooting Suggestions
The URL may be incorrect. The parameters passed to this resource may be incorrect. A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page.
If the error persists please contact the site maintainer. Thank you for your patience.
__________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
On Sun, 5 May 2002 06:59:53 -0400, "Andreas Jung" <andreas@andreas-jung.com> wrote:
I think this behaviour is caused by Toby unicode patches that were merged into the trunk some time ago. Maybe Toby can give an explanation for this behaviour.
Maybe. It would help if the original poster included a traceback to explain *where* this error was raised. I assume it is line 465 of ZPublisher/HTTPRequest.py? The best reference for these changes is currently http://www.zope.org/Members/htrd/howto/unicode
I just check out the zope from cvs. Then I receive error when update properties.
It seems the property menager now try to re-code into unicode, but thinking the input is just latin-1.
Yes. The 'Properties' management page now uses UTF-8, therefore browsers submit the form response using UTF-8 too. For a 'string' property, ZPublisher encodes the unicode value that you type as latin-1. You will get this error if you type non-latin-1 characters as the value of a property of type a 'string', 'int', 'float', 'lines', etc.
Actually, I have just add to the root of my site the property management_page_charset as utf-8 which the manage page correctly default to utf-8 encoding now.
The default in Zope cvs today is for the majority of management pages to use "Content-Type;text/html", meaning the browser has to guess at characer encoding. This is the same as all previous versions of Zope. We chose this conservative default because some management pages are not ready to work with unicode. Some management pages (notably 'Properties') override this default by setting a management_page_charset name in the namespace stack before rendering <dtml-var manage_page_header>. Yes, it is possible to add this property to the root of your folder and override the default for all management pages. I dont recommend it.
But obviously it does not accept chinese. I have also try to add a new property as ustring but also fail.
'ustring' means unicode string. 'ustring' values are *never* latin-1 encoded, so I can not explain this problem. Hmmm. 'ustring' means you can use non-latin-1 characters in the property value, but *not* in the property name. Is that a possible misunderstanding?
Should I need to add chinese / Japanese encoding to python?
No. use 'ustring' and it should 'just work'. Toby Dickenson tdickenson@geminidataloggers.com
On Sun, 5 May 2002 06:59:53 -0400, "Andreas Jung" <andreas@andreas-jung.com> wrote:
I think this behaviour is caused by Toby unicode patches that were merged into the trunk some time ago. Maybe Toby can give an explanation for this behaviour.
Aha! I think the problem is due to insufficient patches...... Andreas has been going through zope changing string.join(x,'') to ''.join(x), while I have been changing some instances to unicode_join(x). unicode_join is like ''.join, but it take care to avoid UnicodeError exceptions like the one reported by kent sin It looks like I overlooked a couple of Anreas changes, and neglected to change them to the unicode variant. This was causing a problem in rendereding the "Properties" management tab if you had both Unicode properties, and plain string properties containing non-ASCII characters. This is fixed in the current cvs. Thanks for the bug report. Toby Dickenson tdickenson@geminidataloggers.com
participants (3)
-
Andreas Jung -
kent sin -
Toby Dickenson