[ZCM] [ZC] 2280/ 1 Request "getPreferredCharsets() returns iso-8859-1 and not utf-8 when HTTP_ACCEPT_CHARSET not present in request"
"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 16 Feb 2007 11:30:27 -0500
| Newsgroups | gmane.comp.web.zope.devel.collector-monitor |
|---|---|
| Message-ID | <[email protected]> |
Issue #2280 Update (Request) "getPreferredCharsets() returns iso-8859-1 and not utf-8 when HTTP_ACCEPT_CHARSET not present in request"
Status Pending, Zope/bug+solution medium
To followup, visit:
http://www.zope.org/Collectors/Zope/2280
==============================================================
= Request - Entry #1 by jost on Feb 16, 2007 11:30 am
I'm not sure if I'm sumitting this the right place or if this is just a local problem not affecting any other, but I have the following problem:
While using Internet Explorer 7 (IE7), the method getPreferredCharsets() in the class HTTPCharsets (http.py) returns 'iso-8859-1' and not 'utf-8' as expected. As far as I know, IE7 does not set the HTTP_ACCEPT_CHARSET in the request. Reading the source I would expect that no HTTP_ACCEPT_CHARSET should result in a return value of 'utf-8'.
At least on my system the line 996 of /lib/python/zope/publisher/http.py
header_present = 'HTTP_ACCEPT_CHARSET' in self.request
sets header_present = True, even if self.request does not contain 'HTTP_ACCEPT_CHARSET'!
Suspecting a problem with the line, not understanding why, I changed it to:
header_present = 'HTTP_ACCEPT_CHARSET' in str(self.request)
This resolves my problem.
###################
Other charset related settings I have changed:
Have set sys.setdefaultencoding('utf-8') in /usr/local/lib/python2.4/site.py.
Have set management_page_charset='utf-8' as property of / in ZMI.
Have set default-zpublisher-encoding utf-8 in etc/zope.conf.
Adding for debug in /lib/python/zope/publisher/http.py (around line 1000):
print type(self.request)
returns:
<type 'instance'>
==============================================================