[Zope] charset from forms input

Toby Dickenson tdickenson@geminidataloggers.com
Fri, 15 Dec 2000 14:28:17 +0000


On Thu, 14 Dec 2000 09:45:53 +1300, Matt <matt.bion@eudoramail.com>
wrote:

>Hi, I seem to have come across the depressing fact that most browsers
>will not return a charset parameter in the http header when a form is
>submitted.  For example, the following from Netscape ... (it happens
>with both IE and Netscape on many platforms I have tried ... Mac, all
>Windows, and Linux).

Yes, this is indeed a problem.

I have developed some patches to support Unicode in ZPublisher which
uses a technique where the character encoding is added to the form
field name (where ZPublisher already expects other marshalling
information)

For example if you have a form with fields named...
address:string
age:int
...you would change those to...
address:utf8:string
age:utf8:int
....if you are expecting your form response to be submitted in utf8.
Under this patch, you could also change that field to.....
address:utf8:ustring
....and store your addresses in unicode.

It is possible to guess what character encoding will be used in a form
response. The situation isnt quite as simple as Dieter Maurer
suggested, but the rules (as I understand them from experimentation)
are in the release notes for this patch.

If anyone knows a better way, I would love to know too.


http://www.zope.org/Members/htrd/wstring

Toby Dickenson
tdickenson@geminidataloggers.com