I tried your suggestion, but it still yields the same error. To be more precise: I have a template which include a general header for my webpages. Further down on the page I want to include a simple html page from our weatherservice. I could do this with an iframe, but then I get problems with the css. So I just wanted the template to include the html.
The template contains the line: #include "/dir/weather_service.html" weather_service.html is in UTF-8 encoding. the error: File "/usr/lib/python2.7/dist-packages/Cheetah/Compiler.py", line 1579, in __init__ Nov 6 10:30:16 weerstation weewx[1367]: **** source = unicode(source) Nov 6 10:30:16 weerstation weewx[1367]: **** UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 751: ordinal not in range(128) Op zondag 6 november 2016 00:17:19 UTC+1 schreef gjr80: > > Hi, > > So have you explicity set or tried changing the encoding parameter for > the report concerned in skin.conf? eg > > [[[testreport]]] > encoding = html_entities > template = testreport.tmpl > > You can read about the encoding parameter in here > <http://weewx.com/docs/customizing.htm#File_generation_options> in the weewx > Customization Guide <http://weewx.com/docs/customizing.htm> > > Gary > > On Sunday, 6 November 2016 08:10:22 UTC+10, Eelco F wrote: >> >> 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 weewx-user+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.