Hi
I use Danish characters, ÆØÅ,  and I just used utf8 for the NOAA reports, 
encoding= utf8 and that is working. CP1252 did not work for me. Delete the 
NOAA txt files and let weewx generate them again.

Gert

On Friday, March 26, 2021 at 9:31:43 PM UTC+1 Thomas Hackler wrote:

> I made the changes but I still get the same errors utf8 blabla :/
> I don't understand this because I never used a "ä" ?
> in the skin.conf is written 
>
> [CheetahGenerator]
> encoding = html_entities
>
> should I change this too to cd1252 ?
>
>
> tke...@gmail.com schrieb am Mittwoch, 24. März 2021 um 16:52:55 UTC+1:
>
>> Unfortunately, character encoding can be a complicated topic. Let's take 
>> this in two parts: the encoding used by the template, and the final 
>> encoding that will appear in the NOAA .txt reports. These are two separate 
>> topics.
>>
>> 1, It appears that you edited the template file and inserted a character, 
>> "ä", encoded in cp1252, into the template. Cheetah must be informed of 
>> this. You do this by including a "#encoding" directive in the file. So, the 
>> top of the file should look like:
>>
>> #errorCatcher Echo
>> #encoding cp1252
>> #set $YM="%Y %m"
>> ...
>>
>> where you should add the highlighted line.
>>
>> 2. Second, now you must tell Cheetah to emit the file using the same 
>> encoding. You do that by going into skin.conf and setting the encoding to 
>> cp1252. When you're done, you end up with something like this:
>>
>>     [[SummaryByMonth]]
>>         # Reports that summarize "by month"
>>         [[[NOAA_month]]]
>>             encoding = cp1252
>>             template = NOAA/NOAA-%Y-%m.txt.tmpl
>>
>>     [[SummaryByYear]]
>>         # Reports that summarize "by year"
>>         [[[NOAA_year]]]
>>             encoding = cp1252
>>             template = NOAA/NOAA-%Y.txt.tmpl
>>
>> Then delete all your NOAA files. At the next reporting cycle, WeeWX will 
>> regenerate the reports hopefully, this time, with the correct encodings.
>>
>> -tk
>>
>>
>> On Wed, Mar 24, 2021 at 6:35 AM Thomas Hackler <thack...@gmail.com> 
>> wrote:
>>
>>> thank you for this advice
>>> how can I encode the file again in UTF-8 ?
>>> maybe I opened the files with the standard editor from the raspberry pi 
>>> but I did not open them in windows
>>> to edit the config files of weewx I use nano
>>>
>>> tke...@gmail.com schrieb am Mittwoch, 24. März 2021 um 13:13:33 UTC+1:
>>>
>>>> Hello,
>>>>
>>>> Did you edit any of these files in a text editor? 
>>>>
>>>> Seasons/NOAA/NOAA-%Y.txt.tmpl
>>>> Seasons/NOAA/NOAA-%Y.txt.tmpl, or 
>>>> Seasons/rss.xml.tmpl
>>>>
>>>>
>>>> My suspicion is that whatever text editor you used assumed the file was 
>>>> encoded in cp1252 (aka windows-1252), rather than UTF-8. 
>>>>
>>>>
>>>> On Wed, Mar 24, 2021 at 1:58 AM Thomas Hackler <thack...@gmail.com> 
>>>> wrote:
>>>>
>>>>>
>>>>> Hello,
>>>>> I have the following utf-8 error and I don't understand why. Maybe you 
>>>>> can help me?
>>>>> 0xe4is a "ä" in German but I try to avoid these special letters. 
>>>>> How can I find the position which causes the problem?
>>>>> Thank you
>>>>> Regards
>>>>> Thomas
>>>>>
>>>>>
>>>>>
>>>>> 11:08:32 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> Generate failed with exception '<type 'exceptions.
>>>>> UnicodeDecodeError'>'
>>>>> Mar 19 11:08:32 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Ignoring template /etc/weewx/skins/Seasons/NOAA/
>>>>> NOAA-%Y-%m.txt.tmpl
>>>>> Mar 19 11:08:32 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Reason: 'utf8' codec can't decode byte 0xe4 in position 1: 
>>>>> unexpected 
>>>>> end of data
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  Traceback (most recent call last):
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, 
>>>>> in generate
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      unicode_string = compiled_template.respond()
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "_etc_weewx_skins_Seasons_NOAA_NOAA__Y__m_txt_tmpl.py", 
>>>>> line 379, in respond
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 641, 
>>>>> in filter
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      filtered = val.decode('utf-8')
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in 
>>>>> decode
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      return codecs.utf_8_decode(input, errors, True)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 
>>>>> 1: unexpected end of data
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> Generate failed with exception '<type 'exceptions.
>>>>> UnicodeDecodeError'>'
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Ignoring template /etc/weewx/skins/Seasons/NOAA/NOAA-%Y.txt.tmpl
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Reason: 'utf8' codec can't decode byte 0xe4 in position 2: 
>>>>> unexpected 
>>>>> end of data
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  Traceback (most recent call last):
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, 
>>>>> in generate
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      unicode_string = compiled_template.respond()
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "_etc_weewx_skins_Seasons_NOAA_NOAA__Y_txt_tmpl.py", 
>>>>> line 892, in respond
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "_etc_weewx_skins_Seasons_NOAA_NOAA__Y_txt_tmpl.py", 
>>>>> line 568, in __errorCatcher64
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "<string>", line 1, in <module>
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 1143, in format
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      addLabel=add_label, localize=localize)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 1128, in toString
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      localize=localize)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 859, in toString
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      val_ustr = six.ensure_text(val_str)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/six.py", line 904, in ensure_text
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      return s.decode(encoding, errors)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in 
>>>>> decode
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      return codecs.utf_8_decode(input, errors, True)
>>>>> Mar 19 11:08:33 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 
>>>>> 2: unexpected end of data
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> Generate failed with exception '<type 'exceptions.
>>>>> UnicodeDecodeError'>'
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Ignoring template /etc/weewx/skins/Seasons/rss.xml.tmpl
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> **** Reason: 'utf8' codec can't decode byte 0xe4 in position 8: invalid 
>>>>> continuation byte
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  Traceback (most recent call last):
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/cheetahgenerator.py", line 323, 
>>>>> in generate
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      unicode_string = compiled_template.respond()
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "_etc_weewx_skins_Seasons_rss_xml_tmpl.py", line 102, in 
>>>>> respond
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 1143, in format
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      addLabel=add_label, localize=localize)
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 1128, in toString
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      localize=localize)
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/weewx/units.py", line 859, in toString
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      val_ustr = six.ensure_text(val_str)
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/share/weewx/six.py", line 904, in ensure_text
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      return s.decode(encoding, errors)
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****    File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in 
>>>>> decode
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****      return codecs.utf_8_decode(input, errors, True)
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] ERROR weewx.cheetahgenerator: 
>>>>> ****  UnicodeDecodeError: 'utf8' codec can't decode byte 0xe4 in position 
>>>>> 8: invalid continuation byte
>>>>> Mar 19 11:08:36 raspberrypi weewx[4685] INFO weewx.cheetahgenerator: 
>>>>> Generated 5 files for report SeasonsReport in 4.10 seconds
>>>>> Mar 19 11:08:37 raspberrypi weewx[4685] DEBUG weewx.manager: Daily 
>>>>> summary version is 2
>>>>> Mar 19 11:08:38 raspberrypi weewx[4685] INFO weewx.imagegenerator: 
>>>>> Generated 16 images for report SeasonsReport in 1.64 seconds
>>>>> Mar 19 11:08:38 raspberrypi weewx[4685] INFO weewx.reportengine: 
>>>>> Copied 5 files to /var/www/html/weewx
>>>>>
>>>>> -- 
>>>>> 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+...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/weewx-user/d58160e4-7eaf-4773-b472-f53849ffe02an%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/weewx-user/d58160e4-7eaf-4773-b472-f53849ffe02an%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 weewx-user+...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/weewx-user/a31c853b-2864-4868-9ab7-397aec2cd291n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/weewx-user/a31c853b-2864-4868-9ab7-397aec2cd291n%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 weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/cff016b3-d0d9-48cf-a01f-23e57dd72c1en%40googlegroups.com.

Reply via email to