[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.3
Stephan Richter
srichter@cbu.edu
Thu, 13 Jun 2002 20:57:20 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv5387/lib/python/Zope/Publisher/HTTP
Modified Files:
HTTPRequest.py
Log Message:
Wrote some code that will convert form and cookie keys and values to
unicode, assuming an UTF-8 encoding. At some point we should probably find
a way to set the encoding based on a place. But this requires some more
serious infrastructure changes and should be discussed first. For now I am
happy that all the input is unicodefied.
=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.2 => 1.3 ===
import RequestDataProperty, RequestDataMapper, RequestDataGetter
+# Default Encoding
+ENCODING = 'UTF-8'
+
class CookieMapper(RequestDataMapper):
_mapname = '_cookies'
@@ -510,8 +513,8 @@
# Match quoted correct cookies
l = len(mo_q.group(1))
- name = mo_q.group(2)
- value = mo_q.group(3)
+ name = unicode(mo_q.group(2), ENCODING)
+ value = unicode(mo_q.group(3), ENCODING)
else:
# Match evil MSIE cookies ;)
@@ -520,8 +523,8 @@
if mo_p:
l = len(mo_p.group(1))
- name = mo_p.group(2)
- value = mo_p.group(3)
+ name = unicode(mo_p.group(2), ENCODING)
+ value = unicode(mo_p.group(3), ENCODING)
else:
return result