Web Weather > Weather Website PHP/AJAX scripting
Display NOAA Reports - WeeWx Plugin
(1/1)
gand:
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
saratogaWX:
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: ---$useUTF8 = true;
--- End code ---
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.
gand:
Hi Ken
Thanks a lot.
Can I remove the ? in Temperature heading? Is it possible to align the page?
Thanks
Rgds
Gert
saratogaWX:
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: ---.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;
}
--- End code ---
with
--- Code: ---.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;
}
--- End code ---
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: --- $rpt = preg_replace('|°|Uis','°',$rpt);
--- End code ---
to
--- Code: --- $rpt = str_replace("\xc2b0",'°',$rpt);
$rpt = preg_replace('|°|Uis','°',$rpt);
--- End code ---
and see if that works.
gand:
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
Navigation
[0] Message Index
Go to full version