[Zope] French language problems
Dieter Maurer
dieter@handshake.de
Fri, 11 May 2001 21:59:01 +0200 (CEST)
Peter Bengtsson writes:
> I want to "filter" the user input a bit.
> If somebody submits name=3D"=E9=E8=E0", in the end I want: name=3D"eea=
"
>=20
> So I tried this:
>=20
> <pseudo atr=3D"filling in the input name=3D'=E9'">
> print self.REQUEST['name'], '=E9'
> print self.REQUEST['name'] =3D=3D '=E9'
> </pseudo>
>=20
> This returns
> '\303\251', '=E9'
> 0
>=20
> Basically, how do I compare self.REQUEST['name'] with '=E9' and get tr=
ue?
> (assuming the name variable is set to "=E9". (you understand what I me=
an)
Your REQUEST variables seem to be "UTF-8" encoded:
'\303\251' is the UTF-8 code of '=E9'.
You have different options:
* convince your browser to send "iso-8859-1" encoded data.
I think, it uses the encoding that he found in the
form constructing page.
But others made different experiences.
Please look into the (searchable) mailing list archives
for the relevant threads.
* handle encoding in your own code (DTML or Script).
Dieter