Check for an #encoding directive at the top of your template. For example,
index.html.tmpl in the Standard template uses:

#errorCatcher Echo
##
## Specifying an encoding of UTF-8 is usually safe:
#encoding UTF-8
##
<!DOCTYPE HTML>
<html lang="en">
  <head>
    ## This choice should match the #encoding directive above
    <meta charset="UTF-8">


-tk

On Wed, Jul 31, 2019 at 2:27 AM peter <[email protected]> wrote:

> If I want to use special (non-English) characters like čžš, I get the
> following error:
> Jul 31 08:21:16 weather weewx[22398]: cheetahgenerator: Generate failed
> with exception '<type 'exceptions.UnicodeDecodeError'>'
> Jul 31 08:21:16 weather weewx[22398]: cheetahgenerator: **** Ignoring
> template /etc/weewx/skins/neowx/index.php.tmpl
> Jul 31 08:21:16 weather weewx[22398]: cheetahgenerator: **** Reason:
> 'ascii' codec can't decode byte 0xc4 in position 10547: ordinal not in
> range(128)
> Jul 31 08:21:16 weather weewx[22398]: ****  Traceback (most recent call
> last):
> Jul 31 08:21:16 weather weewx[22398]: ****    File
> "/usr/share/weewx/weewx/cheetahgenerator.py", line 330, in generate
> Jul 31 08:21:16 weather weewx[22398]: ****      filter=encoding,
> Jul 31 08:21:16 weather weewx[22398]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1336, in
> __init__
> Jul 31 08:21:16 weather weewx[22398]: ****      self._compile(source,
> file, compilerSettings=compilerSettings)
> Jul 31 08:21:16 weather weewx[22398]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1637, in
> _compile
> Jul 31 08:21:16 weather weewx[22398]: ****
>  keepRefToGeneratedCode=True)
> Jul 31 08:21:16 weather weewx[22398]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 772, in compile
> Jul 31 08:21:16 weather weewx[22398]: ****      settings=(compilerSettings
> or {}))
> Jul 31 08:21:16 weather weewx[22398]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Compiler.py", line 1708, in
> __init__
> Jul 31 08:21:16 weather weewx[22398]: ****      source = unicode(source)
> Jul 31 08:21:16 weather weewx[22398]: ****  UnicodeDecodeError: 'ascii'
> codec can't decode byte 0xc4 in position 10547: ordinal not in range(128)
>
> This only happens when I put these characters in the html/php template
> files. The weewx.conf or skin.conf use these characters for parameter
> definition and correctly include them into tags when the html file is being
> generated.
>
> I use standard weewx configuration, no modifications to engine.py etc. I
> checked and the utf-8 is defined in the html templates.
>
> I appreciate suggestions how to make this work.
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/weewx-user/954066dc-08fe-4bf0-b3dc-08604ef25064%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/954066dc-08fe-4bf0-b3dc-08604ef25064%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEA01bT2Xzq22w34ThSF%2BBgU3bYTaOa7MTvrXLn9UjAUpw%40mail.gmail.com.

Reply via email to