Hi,
I'm trying to include some html from an external source in one of my
templates. However these html contains some non-ascii symbols like the
degree symbol or ë, á ï for instance.
These html files are encoded in UTF-8.
The cheetah generator doesn't accept them:
Traceback (most recent call last):
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"/usr/share/weewx/weewx/cheetahgenerator.py", line 315, in generate
Nov 5 23:05:17 weerstation weewx[1367]: **** print >> _file, text
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in
__str__
Nov 5 23:05:17 weerstation weewx[1367]: **** rc = getattr(self,
mainMethName)()
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"cheetah__etc_weewx_skins_Aangepast_beoordeling_html_tmpl_1478382317_27_88088.py",
line 90, in respond
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1597, in
_handleCheetahInclude
Nov 5 23:05:17 weerstation weewx[1367]: **** nestedTemplateClass =
compiler.compile(source=source, file=file)
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 740, in compile
Nov 5 23:05:17 weerstation weewx[1367]: ****
settings=(compilerSettings or {}))
Nov 5 23:05:17 weerstation weewx[1367]: **** File
"/usr/lib/python2.7/dist-packages/Cheetah/Compiler.py", line 1579, in
__init__
Nov 5 23:05:17 weerstation weewx[1367]: **** source = unicode(source)
Nov 5 23:05:17 weerstation weewx[1367]: **** UnicodeDecodeError: 'ascii'
codec can't decode byte 0xc3 in position 720: ordinal not in range(128)
Apparently only the 128 ascii codes are acceptable? So no extended ascii or
UTF-8? Is there a way to get this right?
I could use sed to replace these characters, but I would rather leave them
in place.....
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.