Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Problem with accented letters in scrolling text

Discussion of Mark Crossley's HTML5/Javascript gauges

Moderator: mcrossley

toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Problem with accented letters in scrolling text

Post by toremann »

Hello Everyone!!

I have problem with scrolling text in Gauges status bar on my site.
I live in Norway and we use accented letters like æ, ø and å

You can see my problem at http://jensskogan.com/ss_gauges.php, if the forecas contains accented letters.

Then the forecast contains letters like "æøå "they shows up wrong
I have tryed to to set "digitalForecast : false," in gauges.js, but this do not help

Anyone have a good idea what to do to solve this problem

Best regards

Tore Olsen
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

Typically, there are no extended characters in the forecast at the moment. But I think the problem may be that the realtimegauges.txt file is being sent as "text/plain" which normally defaults to ANSI character set on web servers. If you create (amend existing) .htaccess file to add an extended character set for all .txt files it may fix it.

For instance on my Apache web server I have added additional character sets in overall httpd.conf file (and made utf-8 the default)...

AddDefaultCharset utf-8
AddCharset windows-1252


Then in the NOAA reports folder I have added a .htaccess file to send the the NOAA reports in windows-1252 format...

AddCharset windows-1252 .txt
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello Mark

I have tried all your sugestions whit no luck, if i try to set in character sets in overall httpd.conf file

AddDefaultCharset utf-8
AddCharset iso-8859-1
the whole website goes down.

At the moment i have "tweeked" the forecast so it shows accented letters so if you have a different solution it would be great

BTW! I run a local weserver using XAMPP

Best Regards
Tore
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

I've just taken a look at teh code - always a good idea - and I see that I already applied a workaround for this. The realtimegauges.txt file uses the HTML encoded version of the forecast string. So it comes through as...

Code: Select all

"Stormfullt, mye nedbør"
This is then placed in a div on the DOM, and the text read back from the div...

Code: Select all

data.forecast = $('<div/>').html(data.forecast).text();
However, what is being read back from the div is...

Code: Select all

"Stormfullt, mye nedbør"
Which I think is because the base page is not in the default UTF-8 encoding.

You seem to have lost the encoding instruction from the pages HTML header, and the web server is not returning the base encoding in the response header either.
<meta charset="utf-8">
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello Again

I have tested and tested over again, and i am 100% sure that the page is in UTF-8

Do you have any idea for me to try out, i am a novise in php, so what i do is to try out all the ideas i get

Hopfylly i someday get this right :)

Regards
Tore
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

Your server is sending the following response header:

Code: Select all

Content-Type: text/html
Mine sends:

Code: Select all

Content-Type: text/html; charset=utf-8
Can you create a .htaccess file in the same folder as the ss_gauges.php ?

If so try adding the following entry:

Code: Select all

AddCharset utf-8 ss_gauges.php
That will force just the gauges page to be sent as utf-8 encoded, see what happens then...
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello again Mark

The .htaccess did not work :(

I have even try to change webserver from XAMPP to WAMP, but it is the same

This is a mystery,, i am out of ideas here.

Regards
Tore
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

I overlooked this... Is it the PHP? Try setting the response header in your PHP script (check any existing headers)...

Code: Select all

<?php 
 header('Content-type: text/html; charset=utf-8'); 
?>
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hei Mark

I am sorry but no luck :(

Tore
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

Tore, I don't understand this, the header being sent is still just "Content-Type:text/html" from my limited understanding of PHP if you have the code "header('Content-type: text/html; charset=utf-8');" it should be reflected in the header sent. Is there an option in your PHP to view the source code?
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello Mark

Please finde attached "ss_gauges.php", its in a .zip file.

Maby you could se whats wrong in the source code

Regards

Tore
ss_gauges.zip
You do not have the required permissions to view the files attached to this post.
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

Hmm, my only suggestion would be to move just the single header line to immediately after

// Include language files available in lang folder
include('include/local_lang.php');

at lines 29/30

and delete the three lines you have put at the top of the script.

(I cannot see what the included files are doing, they may be over riding the header statement you have put at the top of the script.)
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello again Mark

Did the changes you aske me to do, see the attached file
That did not help!!

I guess this means that its not possible to solve this problem :?

Have a great day

Tore
ss_gauges.zip
You do not have the required permissions to view the files attached to this post.
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Problem with accented letters in scrolling text

Post by mcrossley »

I guess this means that its not possible to solve this problem :?
Never say that! :lol: It is working for other people using extended language characters.

I have run this through the bugger, and manually looked up the character codes, and guess what? The code is working! :bash:

Your current forecast is "Pent v&#195;&#166;r"

This is being converted to "Pent vær"

&#195; = Ã
&#166; = ¦

So the web page decode has been working all along, it looks like the problem may lie at the Cumulus end.

Can you check your "strings.ini" file, are the strings correct in there?
Does the correct string appear in Cumulus its self?
How does the "Pent v&#195;&#166;r" appear in strings.ini?

In fact it may be worth posting your strings.ini 'as-is'.
toremann
Posts: 15
Joined: Tue 23 Apr 2013 11:43 am
Weather Station: Fine Offset 2080
Operating System: OSX Yosemit Version 10.10.3
Location: Norway
Contact:

Re: Problem with accented letters in scrolling text

Post by toremann »

Hello again Mark

I think you are correct

Does the correct string appear in Cumulus its self? you ask, and the answer is NO, i got the same issue there.

The strings.ini seems correct translated into Norwegian

I attach the strings.ini

Best regards

Tore
strings.ini
You do not have the required permissions to view the files attached to this post.
Post Reply