Commit 788d1b2a authored by Jérome Perrin's avatar Jérome Perrin

web_runderjs_ui: serve web script, style and manifest with explicit charset

In HTTP/1.1 , when not specified , charset detault to ISO-8859-1

https://tools.ietf.org/html/rfc2616#section-3.7.1

> media subtypes of the "text"  type are defined to have a default charset value of "ISO-8859-1" when   received via HTTP

Zope adds a charset with default encoding (
https://github.com/zopefoundation/Zope/blob/2.13/src/ZPublisher/HTTPResponse.py#L512-L515 ) but does this only for text/ type, but we serve our javascript as application/javascript
parent 3b13a934
......@@ -15,13 +15,13 @@ web_content = web_page.getTextContent()
# set headers depending on type of script
if (portal_type == "Web Script"):
response.setHeader('Content-Type', 'application/javascript')
response.setHeader('Content-Type', 'application/javascript; charset=utf-8')
elif (portal_type == "Web Style"):
response.setHeader('Content-Type', 'text/css')
response.setHeader('Content-Type', 'text/css; charset=utf-8')
elif (portal_type == "Web Manifest"):
response.setHeader('Content-Type', 'text/cache-manifest')
response.setHeader('Content-Type', 'text/cache-manifest; charset=utf-8')
else:
if (mapping_dict is not None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment