Commit 37efde49 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 6194d3c5
...@@ -22,13 +22,13 @@ web_content = web_page.getTextContent() ...@@ -22,13 +22,13 @@ web_content = web_page.getTextContent()
# set headers depending on type of script # set headers depending on type of script
if (portal_type == "Web 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"): 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"): elif (portal_type == "Web Manifest"):
response.setHeader('Content-Type', 'text/cache-manifest') response.setHeader('Content-Type', 'text/cache-manifest; charset=utf-8')
else: else:
if (mapping_dict is not None): 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