Modify ↓
#10340 closed defect (fixed)
Specify character encoding in pages returned by wiki.getPageHTML
| Reported by: | nashville_parent | Owned by: | osimons |
|---|---|---|---|
| Priority: | normal | Component: | XmlRpcPlugin |
| Severity: | normal | Keywords: | encoding, utf8, utf-8 |
| Cc: | olemis | Trac Release: | 1.0 |
Description
No character encoding is specified in the HTML returned by wiki.getPageHTML / wiki.getPageHTMLVersion.
By default, Trac appears to use UTF-8 encoding throughout (see page template here), however this is not necessarily the encoding which is used by the web-browser viewing the generated file. For example, my copy of Internet Explorer attempts to render it as Western European (Windows) when encoding auto-select is enabled.
To resolve this, it appears that we can simply change wiki.py line 115 (as at r11148) from -
return '<html><body>%s</body></html>' % html
to:
return '<html><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><body>%s</body></html>' % html
Attachments (0)
Change History (3)
comment:1 Changed 9 months ago by osimons
comment:2 Changed 9 months ago by nashville_parent
Yep, that sounds sensible to me.
comment:3 Changed 9 months ago by osimons
- Resolution set to fixed
- Status changed from new to closed
Fixed in [12107].
Note: See
TracTickets for help on using
tickets.


Thanks for reporting. You are correct in that the output is ambiguous without some declaration of encoding.
Would that suffice? Explicit encode + update docs? As long as the client can rely on UTF-8 there should be no ambiguity, right?