Author Topic: Display NOAA Reports - WeeWx Plugin  (Read 458 times)

0 Members and 1 Guest are viewing this topic.

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
Display NOAA Reports - WeeWx Plugin
« on: May 18, 2021, 11:43:45 PM »
Hi Ken

I have a question about viewing NOAA reports. As can be seen from the screenshot, Danish characters are not displayed correctly. The report itself shows the Danish characters correctly.

In addition, parts of the report are displayed outside the screen.

Thanks

Rgds
Gert

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Display NOAA Reports - WeeWx Plugin
« Reply #1 on: May 19, 2021, 12:10:44 AM »
This is a classic case.. your system is generating the NOAA reports using UTF-8, and the template is expecting them in ISO-8859-1.

On the wxnoaareports.php page, before the include("top.php"); just add
Code: [Select]
$useUTF8 = true; and the page default will switch to UTF-8 and the NOAA reports should display correctly.

The template set was originally written at a time when UTF-8 was just beginning, so I'd adopted the Latin ISO-8859-n sets for use in the template.
The override above should fix the anomaly for that page.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
Re: Display NOAA Reports - WeeWx Plugin
« Reply #2 on: May 19, 2021, 12:54:21 AM »
Hi Ken

Thanks a lot.

Can I remove the ? in Temperature heading? Is it possible to align the page?

Thanks

Rgds
Gert

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9257
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Display NOAA Reports - WeeWx Plugin
« Reply #3 on: May 19, 2021, 11:34:18 AM »
So, two things:
1) the YEAR reports don't fit as they are wider (more spaces) than the other weather software's YEAR reports.  You can change the display by editing
wxnoaaclimatereports.php to replace
Code: [Select]
.noaa_rep_container pre {
    color: #000000;
    font-family: monospace;
    font-size: 9pt;
    font-weight: normal;
    text-align: left;
    border: 1px solid #000000;
    border-radius: 10px 10px 10px 10px;
    padding: 20px 0px 25px 20px;
background-color: #f9f8EB;
}
with
Code: [Select]
.noaa_rep_container pre {
    color: #000000;
    font-family: monospace;
    font-size: 10px;
    font-weight: normal;
    text-align: left;
    border: 1px solid #000000;
    border-radius: 10px 10px 10px 10px;
    padding: 20px 0px 25px 20px;
background-color: #f9f8EB;
}
and that will make all the reports smaller (but fit in the narrow space allowed).

The ? is caused by the degree sign character which is incorrectly translated.  Change include-NOAA-reports.php from
Code: [Select]
$rpt = preg_replace('|°|Uis','°',$rpt);
to
Code: [Select]
$rpt = str_replace("\xc2b0",'°',$rpt);
$rpt = preg_replace('|°|Uis','°',$rpt);
and see if that works.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline gand

  • Senior Member
  • **
  • Posts: 61
    • Lynghuzed
Re: Display NOAA Reports - WeeWx Plugin
« Reply #4 on: May 19, 2021, 12:30:15 PM »
Hi Ken

The display is perfect, thanks for that.

I changed the lines you proposed, but no luck. I still have the �

I have attached the file.

Gert

 

anything