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 "³", or
"³". 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 <[email protected]> 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 [email protected].
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/CAPq0zEBUC-m5fEkyjh7DgaQOMvRUvcp82ZmfqWU4XU8gN7a54A%40mail.gmail.com.

Reply via email to