Page 2 of 3

Re: NOAA Reports

Posted: Fri 17 Mar 2023 3:16 pm
by freddie
Looks like the path used. It should be:

Code: Select all

Reports
Not:

Code: Select all

/Reports

Re: NOAA Reports

Posted: Fri 17 Mar 2023 3:39 pm
by mcrossley
OK, I have a bit more information about this now.

The report option for UTF8 works for the local files, they are saved as either UTF-8 or ISO-8859-1.

However, the PHP upload always creates remote files with UTF-8 encoding.

I've fixed this with changes both to CMX to pass an encoding flag to the Upload.php script, and a change to the upload.php script to then save the files according to the encoding flag. In-flight between CMX and PHP all text is encoded as UTF-8.

FTP and SFTP are unaffected.

Re: NOAA Reports

Posted: Fri 17 Mar 2023 7:14 pm
by qisdtech
freddie wrote: Fri 17 Mar 2023 3:16 pm Looks like the path used. It should be:

Code: Select all

Reports
Not:

Code: Select all

/Reports
Thanks Freddie. I've made this correction and we'll see how it goes tonight.

Re: NOAA Reports

Posted: Sat 18 Mar 2023 5:07 am
by qisdtech
All seems to be uploading at end of day now using PHP. Thanks again Freddie!

Re: NOAA Reports

Posted: Sat 18 Mar 2023 10:45 am
by ConligWX
not sure if this helps, but your noaa_climate.php on your original page shows:

Code: Select all

// 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 &deg
   $rpt = str_replace($dodgy,'°',$rpt);
// END nasty work around
   echo "<pre>\n";
   $rpt = preg_replace('/State: Dorset/i', 'County: Dorset   Country: UK', $rpt, 1);
   echo preg_replace('|<|Uis','&lt;',$rpt);
   echo "</pre>\n";
I know the original include-NOAA-reports.php that Ken True provided gave me issues too. Ken gave me a workaround like so:

So, there's two ways to do this:
1) (easy) force the wxnoaareports.php page to use UTF-8.
Just add
Code: [Select]
$useUTF8 = true;
before the include("top.php");
and the page will display in UTF-8.

2) (a bit harder) change include-NOAA-reports.php
Code: [Select]
$rpt = preg_replace('|°|Uis','&deg;',$rpt);
echo $rpt;
to

Code: [Select]
// $rpt = preg_replace('|°|Uis','&deg;',$rpt);
$rpt = iconv('UTF-8',$SITE['charset'].'//TRANSLIT',$rpt);
echo $rpt;
and that should convert the degree sign for you.
only the second solution worked for me for my Saratoga Templates, yet on my CumulusMX templates they just work, and use the same NOAA report files!

I'm not sure if you can get your code to work with Kens fix as beteljuice hacked your noaa_climate.php to make it work. however ALL my NOAA txt files are UTF-8 encoded.

Re: NOAA Reports

Posted: Sat 18 Mar 2023 11:19 am
by HansR
Sometimes I wonder if anybody understands the use of the encoding.
If a document is encoded UTF8 (as all CMX documents are afaik) then simply make your site UTF8 (which is the sensible thing to do these days)
I really do not understand why anybody would use a ISO-8859-x encoding when displaying UTF8 docs (or the other way around).
:groan:

[EDIT:]It seems to be possible and happening that a server ignores the UTF-8 encoding and serves the end user with another encoding. I'll ignore that. Just get another server, we do not need more confusion. I have never seen this btw.

Re: NOAA Reports

Posted: Sat 18 Mar 2023 11:45 am
by Mapantz
All I can tell you is, I have never touched my NOAA reports since I started using CMX back in 2016. They've always displayed correctly on my website. As I mentioned earlier in the thread, manually uploading them via FTP and using CMX''s FTP has never been an issue, until I swapped over to PHP upload.

All academic now, as Mark has identified the issue.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 2:52 pm
by HansR
On the risk of increasing the confusion I would like to mention that I just had a communication with a user who does run CMX 3.24, does NOT use upload.php but does nonetheless conclude that CMX does no longer create its files in UTF8 (but is not good enough in English according to himself).

My conclusion (as it was before) is that the issue has nothing to do with upload.php (or PHP as a whole) but lies somewhere else.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 4:29 pm
by Mapantz
HansR wrote: Sun 19 Mar 2023 2:52 pm
My conclusion (as it was before) is that the issue has nothing to do with upload.php (or PHP as a whole) but lies somewhere else.
If I turn off PHP uploads and go back to FTP, it works fine.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 5:01 pm
by HansR
Mapantz wrote: Sun 19 Mar 2023 4:29 pm
HansR wrote: Sun 19 Mar 2023 2:52 pm
My conclusion (as it was before) is that the issue has nothing to do with upload.php (or PHP as a whole) but lies somewhere else.
If I turn off PHP uploads and go back to FTP, it works fine.
If i turn on php upload i don't have the non-utf8 reports.
So what do you prove with your remark?

Re: NOAA Reports

Posted: Sun 19 Mar 2023 5:21 pm
by Mapantz
HansR wrote: Sun 19 Mar 2023 5:01 pm
Mapantz wrote: Sun 19 Mar 2023 4:29 pm
HansR wrote: Sun 19 Mar 2023 2:52 pm
My conclusion (as it was before) is that the issue has nothing to do with upload.php (or PHP as a whole) but lies somewhere else.
If I turn off PHP uploads and go back to FTP, it works fine.
If i turn on php upload i don't have the non-utf8 reports.
So what do you prove with your remark?
I already answered that, twice. For a third time, no UTF8 issues with FTP. Issues with UTF8 when using PHP upload.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 6:06 pm
by HansR
Mapantz wrote: Sun 19 Mar 2023 5:21 pm I already answered that, twice. For a third time, no UTF8 issues with FTP. Issues with UTF8 when using PHP upload.
And I claim two cases which contradict your statement:
  1. @Mapantz: PHP upload, issues with UTF8
  2. @Meteo19: FTP upload, issues with UTF8
  3. @HansR: PHP upload, no issues with UTF8
@Mapantz: you have no case with PHP upload except that there is an issue with UTF8.
And I agree that the issue apparently is misty, but I am not convinced, actually I don't agree, that is related to PHP upload. It can be related to PHP though: @meteo19 had to modify his (PHP) sites (I translate from French):
For the new version of CMX nice progress but it forced me to review each of my pages because the months with accents like February August December were all distorted I have the impression that MX no longer transmits in UTF 8.
(Note that he uses FTP).

Ignoring this will give some pain for future release as the issue is not solved to (all) the observations.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 6:10 pm
by Mapantz
I posted this topic because I have a problem. If you don't have any issues, then don't argue with me. Thanks.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 6:25 pm
by HansR
But meteo19, a user of CUtils, does have a problem which is the inverse of yours. And that makes it partly my problem because when we meddle with an issue which looks different from two sides, a fix solves probably nothing but only makes things more complex.
Mapantz wrote: Sun 19 Mar 2023 6:10 pm If you don't have any issues, then don't argue with me. Thanks.
I am not arguing with you, Thanks. I am arguing the issue is not what it seems by some and that means that the solution brought by Mark will most likely not solve it. I argue for the community, the tool, CMX. Thanks for understanding. Thanks.

Re: NOAA Reports

Posted: Sun 19 Mar 2023 6:54 pm
by Mapantz
Mark has already said he solved it, read further up. :groan:

Fed up with your patronising and argumentative replies. You're going on ignore.