WXforum.net

Weather Software => Other Weather Software => Topic started by: griffo42 on January 09, 2018, 07:09:24 AM

Title: NOAA Report Problem
Post by: griffo42 on January 09, 2018, 07:09:24 AM
Hi all

I am using the Saratoga templates and Cumulus.

The NOAA report prepared by Cumulus correctly shows the "degree" symbol - see the attachment NOAA Report - Cumulus.

To get the Cumulus report into my Saratoga based website I run the program NOAAReportssaratoga.php.  The report which then appears in my website does not show the "degree" symbol at all - see the attachment NOAAReport - Saratoga.

Am I using the correct software to get from Cumulus to Saratoga for this?  If not, please suggest the correct one to use.

Otherwise can someone please suggest a fix so that the "degree" symbol is shown correctly in the Saratoga report and thus on my website.

Thanks

griffo42 [ You are not allowed to view attachments ]  [ You are not allowed to view attachments ]

Title: Re: NOAA Report Problem
Post by: tmabell on January 09, 2018, 07:41:21 AM
This has to do with the Character encoding on your page.  I had that happen and couldn't get it to cooperate so I added this code as a workaround:

Code: [Select]
<?php
ini_set
('default_charset'"");
?>

Ken can tell you how to fix it the right way but that worked for me.
Title: Re: NOAA Report Problem
Post by: saratogaWX on January 09, 2018, 11:55:14 AM
The page in the iframe NOAA-reportssaratoga.php is coming in as UTF-8, and needs to be in ISO-8859-1 to display the degree symbol.

Insert in your php.ini in the document root of your website.

default_charset = "ISO-8859-1"

and that should fix the issue.
Title: Re: NOAA Report Problem
Post by: griffo42 on January 10, 2018, 07:29:31 PM
Hi Ken

Thanks for your advice to fix my problem, however I must not have done it correctly as the problem is not fixed. 

This is the report of this morning.  [ You are not allowed to view attachments ]
This is a scan cut of my website's root directory.  The php.ini file is in the folder "etc". [ You are not allowed to view attachments ]
Here in the attachment is the php.ini file.

I seem to have done something incorrectly.  Please suggest a fix in the light of all of this, if you are able to.

Thanks

griffo42 (Keith)

Ed.note: removed 3rd attachment-it was a view-source of a wxforum.net page, not a php.ini file.
Title: Re: NOAA Report Problem
Post by: tmabell on January 11, 2018, 07:23:49 AM
Your experience mirrors mine.  I made all the changes that were obvious to me regarding the default_charset to no avail.  I too must have missed something.  I then resorted to adding the code I mentioned earlier in this thread to the top of the script and the issue was resolved.  As I said, this isn't the best way to fix it but it did work for me.  I have had so many issues since moving to PHP 7+ and I wonder if that may be the reason this suddenly started happening.
Title: Re: NOAA Report Problem
Post by: saratogaWX on January 11, 2018, 10:54:38 AM
The php.ini file would be in your public_html directory (which, according to the screen capture, is likely your website's document root).
Title: Re: NOAA Report Problem
Post by: tmabell on January 11, 2018, 11:25:50 AM
In my case, this is the entry that defines charset:

Code: [Select]
; PHP's default character set is set to empty.
; http://php.net/default-charset
; default_charset = "UTF-8"

While UTF-8 is the problem I was under the impression that by leaving it blank or commenting it out would allow scripts, etc. to define the character set as needed for each one.  Am I off with my thinking?
Title: Re: NOAA Report Problem
Post by: saratogaWX on January 11, 2018, 11:38:25 AM
Sometimes, it's the Apache httpd.conf that sets a default character set (if the PHP doesn't).   The PHP order of processing is the master php.ini, then overrides by the php.ini in the document root (if any).   PHP 7+ defaults to UTF-8 if it's not explicitly specified.  PHP 5 used ISO-8859-1 default if not explicitly specified.
Title: Re: NOAA Report Problem
Post by: tmabell on January 11, 2018, 11:46:20 AM
Now I understand.  That would explain why the degree symbol got strange after the PHP upgrade to 7.  Thanks very much Ken, I will make the needed changes.

EDIT:  That fixed the issue!
Title: Re: NOAA Report Problem
Post by: griffo42 on January 11, 2018, 08:41:36 PM
Despite copying the php.ini file from the 0:/etc folder to 0:/ root  and/or to my 0:/public_html folder none of these worked for me. 

I tried tmabell's fix shown in his first post and that works for me. 

It annoys me that I can't fix it according to Ken's suggestions but I don't know enough about programming in PHP.

Thanks to both for all your help.

griffo42 (Keith)