Re: PHP Web 'viewer' for Cumulus NOAA Style reports
Posted: Sun 11 Mar 2012 12:19 am
I'm glad you see that as well, I'm fed up of people telling me I'm seeing things when I get funny characters on their sites (Including ordinary html) !
The unproven response is the wrong charset is applied to the format in which the file was written and / or saved in.
The report itself is created by Cumulus, Notepad++ says "ANSI as UTF-8"
Notepad++ reports your page as "ANSI as UTF-8", and is declared as UTF-8 in it's META data.
Interestingly, in my browser, your .txt reports show the black diamond, but not in notepad++, the .txt reports on my site do not show the black diamond in my browser
Time for an experiment
Using notepad I want you to modify NOAA-reports.php
MAKE A BACKUP OF IT FIRST !
Go down to about line 430 and change from this:To this:Caution: I can't find the real code for the black diamond anywhere
This will replace ALL instances of the 'black diamond' with ° (degree symbol)
Edit: a couple of silly errors removed.
Upload the modified file to your site and let's see what happens
(Edit: It works !)
If anyone has a definitive answer as to why this kind of problem occurs and how to prevent it in the first place .....
The unproven response is the wrong charset is applied to the format in which the file was written and / or saved in.
The report itself is created by Cumulus, Notepad++ says "ANSI as UTF-8"
Notepad++ reports your page as "ANSI as UTF-8", and is declared as UTF-8 in it's META data.
Interestingly, in my browser, your .txt reports show the black diamond, but not in notepad++, the .txt reports on my site do not show the black diamond in my browser
Time for an experiment
Using notepad I want you to modify NOAA-reports.php
MAKE A BACKUP OF IT FIRST !
Go down to about line 430 and change from this:
Code: Select all
if($rpt){
echo "<pre>\n";
echo preg_replace('|<|Uis','<',$rpt);
echo "</pre>\n";
}
echo "</div> <!-- END noaa_rep_container -->\n";Code: Select all
if($rpt){
// NASTY work-around, the ONLY way I find black diamond question mark (or deg character)
$checkIt = explode("(", $rpt);
$dodgy = substr($checkIt[1],0 , 1);
// the ONLY way I can replace when black diamond (unconditionally) to °
$rpt = str_replace($dodgy,'°',$rpt);
// END nasty work around
echo "<pre>\n";
echo preg_replace('|<|Uis','<',$rpt);
echo "</pre>\n";
}
echo "</div> <!-- END noaa_rep_container -->\n";Edit: a couple of silly errors removed.
Upload the modified file to your site and let's see what happens
If anyone has a definitive answer as to why this kind of problem occurs and how to prevent it in the first place .....