Both the template and the skin configuration look fine.

Despite being just down the road from you, I am unable to connect to your
webserver.



On Thu, Aug 24, 2023 at 5:15 PM vince <vinceska...@gmail.com> wrote:

> URL that rsync uploads to is https://www.skahan.net/weewx/purpleair.html
> - this will not be available unless you're in US/CA/AU probably due to some
> geoip blocking that I have set up on the ISP side to try to limit how many
> bots bang on the site.
>
> Same thing happens on chrome on mac os and iphone as well as Safari on mac
> os.   The weewx host is a current RaspiOS pi4.   Adding the encoding=utf_8
> line didn't help, unfortunately.  The encoding was previously set to
> html_entities in skin.conf
>
> I've attached the .tmpl file and skin.conf for the skin in case there are
> obvious errors therein.  FWIW the skin is kinda ancient so it's possible I
> missed adding something along the way.
>
>
> On Thursday, August 24, 2023 at 3:58:44 PM UTC-7 Tom Keffer wrote:
>
>> Internal to WeeWX, the label microgram_per_meter_cubed is encoded in
>> Unicode. To be included in a template, it has to be converted to an
>> appropriate byte string using an encoding. By default, the Seasons
>> templates use html entities to do this encoding. The results will be in
>> simple ASCII.
>>
>> Note: this is *separate* from the encoding used by the templates
>> themselves, which is generally UTF-8. This is what you're setting with the
>> #encoding directive. This is useful if one were to include UTF-8 characters 
>> *directly
>> in the templates themselves*. But, that's not what's happening here.
>>
>> The html entity encoding for the cube symbol is either "&sup3;", or
>> "&#179;". For whatever reason, your Python installation is choosing the
>> latter, which your browser does not seem to be capable of interpreting as
>> the cube symbol. I've seen this happen when the file suffix is ".txt", but
>> yours is ".html" (check!).
>>
>> It may be a browser specific thing. What browser are you using? Perhaps
>> you can point us to the page?
>>
>> One thing you can try is another encoding besides html entities. For
>> example, utf-8.
>>
>> *[CheetahGenerator]*
>> *  encoding=utf_8 *
>>
>>
>>
>> On Thu, Aug 24, 2023 at 3:30 PM vince <vince...@gmail.com> wrote:
>>
>>> Thanks.  No joy.
>>>
>>> Added to top of the file under the echo line ala...
>>>
>>> ## Copyright 2009-2018 Tom Keffer, Matthew Wall
>>> ## Distributed under terms of GPLv3.  See LICENSE.txt for your rights.
>>> #errorCatcher Echo
>>> #encoding UTF-8
>>>
>>> #set $periods = $to_list($DisplayOptions.get('periods', ['day', 'week',
>>> 'month', 'year']))
>>> #set $plot_groups = $to_list($DisplayOptions.get('plot_groups',
>>> ['tempdew', 'wind', 'rain']))
>>>
>>> ## use this span to determine whether there are any data to consider.
>>> #set $recent=$span($day_delta=30, boundary='midnight')
>>>
>>> <!DOCTYPE html>
>>> <html lang="$lang">
>>>   <head>
>>>     <meta charset="UTF-8">
>>>     <title>$station.location</title>
>>>     <link rel="icon" type="image/png" href="favicon.ico" />
>>>     <link rel="stylesheet" type="text/css" href="seasons.css"/>
>>>     #if $station.station_url
>>>     <link rel="canonical" href="$station.station_url/$filename" />
>>>     #end if
>>>     <script src="seasons.js"></script>
>>>   </head>
>>>
>>>   <body onload="setup();">
>>>     #include "titlebar.inc"
>>>
>>> And appended the AQI line to the footer to make it easier for me to find
>>> during testing...
>>>
>>>     <p class="footnote">
>>>       $gettext("This station is controlled by <a 
>>> href='https://weewx.com'>WeeWX</a>,
>>> an experimental weather software system written in Python.")
>>>       AQI:
>>> $latest('purpleair_binding').aqi2_5.format(format_string="%.0f")
>>>  ($latest('purpleair_binding').pm2_5_cf_1.format(format_string="%.1f"))
>>>
>>>
>>> Result looks like:
>>>       This station is controlled by WeeWX <https://weewx.com/>, an
>>> experimental weather software system written in Python. AQI: 64 (17.9
>>> µg/m³)
>>>
>>> Output in the .html is:
>>>    <p class="footnote">
>>>       This station is controlled by <a href='https://weewx.com'>WeeWX</a>,
>>> an experimental weather software system written in Python.
>>> AQI: 64    (17.9 &#194;&#181;g/m&#194;&#179;)
>>>
>>> On Thursday, August 24, 2023 at 3:16:01 PM UTC-7 gjr80 wrote:
>>>
>>>> I notice the Seasons index.html.tmpl does not have a #encoding
>>>> directive (though the other Seasons .html.tmpl files do). Have you
>>>> tried adding a #encoding directive à la:
>>>>
>>>> #errorCatcher Echo #encoding UTF-8 <!DOCTYPE html>
>>>>
>>>> Gary
>>>>
>>>> On Friday, 25 August 2023 at 07:19:12 UTC+10 vince wrote:
>>>>
>>>>> Well I can't explain it at all.  I appended the same .tmpl line at the
>>>>> bottom of index.html.tmpl for the Seasons skin (trusting Tom gets this
>>>>> stuff correctly) and I still see funny encoding in Safari + Chrome (mac)
>>>>> and in Chrome (iphone).   I can only guess it has something to do with the
>>>>> locale or i18n settings on the pi4 that weewx is running on, but I'm just
>>>>> guessing completely at this point.
>>>>>
>>>>> On Thursday, August 24, 2023 at 12:54:21 PM UTC-7 Karen K wrote:
>>>>>
>>>>>> Unfortunately the greek my character and the cubic symbol are not
>>>>>> US-ASCII. So they have the 8th bit set. There are different methods to do
>>>>>> that. The older one is ISO 8859, where one byte is always one character.
>>>>>> The newer one is UTF-8 where one character can be 1, 2 or even more 
>>>>>> bytes.
>>>>>> So if you have an UTF-8 character, containing of 2 bytes interpreted as 
>>>>>> ISO
>>>>>> 8859, you see 2 characters instead of the one you want to see.
>>>>>>
>>>>>> So the question is: What does the browser think about the character
>>>>>> set? And what character set is used for Cheetah?
>>>>>>
>>>>>> See the first line of the templates *.html.tmpl. There is a line
>>>>>> beginning with #encoding followed by the name of a character set. That 
>>>>>> name
>>>>>> must match the character set you used to save the file.
>>>>>>
>>>>>> Then there may be a line <meta charset="UTF-8" /> (or ISO-8859-1
>>>>>> instead of UTF-8).
>>>>>>
>>>>>> Then, in skin.conf there may be lines "encoding = ...". What do they
>>>>>> say?
>>>>>>
>>>>>> Make sure, all the encoding directives match your file's encoding.
>>>>>>
>>>>>> vince schrieb am Donnerstag, 24. August 2023 um 21:29:46 UTC+2:
>>>>>>
>>>>>>> I have absolutely no idea what you just said.  Sorry - US ASCII
>>>>>>> person here :-)
>>>>>>>
>>>>>>> View source shows
>>>>>>> AQI: 56    (14.6 &#194;&#181;g/m&#194;&#179;)
>>>>>>>
>>>>>>> and https://www.w3schools.com/charsets/ref_html_8859.asp matches up
>>>>>>> (circumflex accent and micro symbol) but I have no idea what to do 
>>>>>>> about it.
>>>>>>>
>>>>>>>
>>>>>>> --
>>> 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/d39d52c7-3a0d-4a2a-93a8-97fb2f329b7fn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/d39d52c7-3a0d-4a2a-93a8-97fb2f329b7fn%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/34810d7b-e939-4f26-9868-41da36ffc992n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/34810d7b-e939-4f26-9868-41da36ffc992n%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/CAPq0zEB%2B7TRzf5rdY7LndCqb-cW8jf%2Bj_K8xUqtE9B%2ByiuBdnA%40mail.gmail.com.

Reply via email to