Occasional font encoding problem -- specific page and specific browser

General questions regarding the use of languages in Joomla! 3.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Occasional font encoding problem -- specific page and specific browser

Post by Marvin_Martiano » Fri Jun 24, 2016 4:25 pm

I have a bilingual website installed as Joomla 1.6 and upgraded over time 1.7 / 2.5 / 3.0. It has a template (based long ago on the Beez20 accessible template) that declares itself UTF-8 in the head with a <meta> tag, and it works correctly in all browsers encountered. So far so good.

I've got an error.php template that's the regular correctly-working index.php but with all nonessentials stripped (no nav menu, for starters), just simplified, and then the essential bits from the regular error.php template inserted. So you get lines like

Code: Select all

<h2><?php echo JText::_('JERROR_AN_ERROR_HAS_OCCURRED'); ?><br />
<?php echo JText::_('JERROR_LAYOUT_PAGE_NOT_FOUND'); ?> <strong> </h2>
which are read from the language's .ini file (like /language/en-US/en-US.ini for american english). These files themselves are correctly set to UTF8 says my editor.

Now, the issue is, if I type in a nonsense URL on my page to get a 404 screen while set to an accent-heavy language, it looks correct in Firefox but has typical encoding errors in (an updated) Chrome and Safari. Switching computer I get the same (Firefox OK, Chrome and Safari bad). Recognizable errors are e.g., "à" becomes "Ã " [see e.g. http://www.i18nqa.com/debug/utf8-debug.html ].

Any idea where to look? As said, both index.php and error.php declare themselves UTF8, it's correct in Firefox, and in all browsers the normal pages show correct accents within the articles.

EDIT: temporarily adding a menu item that caused system text (login form) to be displayed, I saw correct accents in all browsers there... so it seems to be error.php's fault? (Not allowed to attach .php file.)

itoctopus
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4025
Joined: Mon Nov 25, 2013 4:35 pm
Location: Montreal, Canada
Contact:

Re: Occasional font encoding problem -- specific page and specific browser

Post by itoctopus » Sat Jun 25, 2016 11:26 pm

What happens when you add the following to the very beginning of the error.php file:

Code: Select all

header('Content-Type: charset=utf-8');
OR

Code: Select all

mb_internal_encoding("UTF-8");
http://www.itoctopus.com - Joomla consulting at its finest
https://twitter.com/itoctopus - Follow us on Twitter

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Occasional font encoding problem -- specific page and specific browser

Post by Marvin_Martiano » Sun Jun 26, 2016 10:22 am

Neither has an effect! They also don't seem to make a difference to the HTML output (I put in a trivial change to verify it's indeed updating correctly; I'm not accidentally looking at cache)?

I've put it in various places in the opening ?php statement, namely before/after the "exec or die", and before/after the JHTML-declaration, and either and both of the versions you suggest: No effect. Chrome > View > Encoding > Autodetect keeps saying the error page is Windows1252, the rest of the site UTF8.

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Occasional font encoding problem -- specific page and specific browser

Post by Marvin_Martiano » Sun Jun 26, 2016 12:10 pm

BTW, a sample of 404 pages is http://lucaleonelli.org/refresh/it/blah. I cannot post or attach PHP so here's the best i can come up with, a screenshot of it (further reduced to fit screen)...
Screenshot 2016-06-26 13.07.14.png
You do not have the required permissions to view the files attached to this post.

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30931
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Occasional font encoding problem -- specific page and specific browser

Post by Per Yngve Berg » Sun Jun 26, 2016 1:40 pm

Add a to the head section of your error page.

Code: Select all

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Occasional font encoding problem -- specific page and specific browser

Post by infograf768 » Sun Jun 26, 2016 1:41 pm

Set your preferences in Chrome and Safari


Screen Shot 2016-06-26 at 15.34.55.png
Screen Shot 2016-06-26 at 15.36.47.png
You do not have the required permissions to view the files attached to this post.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

Re: Occasional font encoding problem -- specific page and specific browser

Post by Marvin_Martiano » Sun Jun 26, 2016 6:07 pm

Hi Per,
That line is there already (2 lines before end of head section); unless I have a typo and then it's explained.

Hi Infograph,
But as a solution that would mean that I change the settings OF ALL MY VISITORS? I don't mind what happens with my computer, it's the site's users that need to see it. So indeed my defaults were Windows-1252 [and Firefox to "default for current locale", but that's not specified what encoding that is -- I'm in UK and setting is en-US anyway], and hence the problem showed...

So all this means that someway my <meta ... charset=utf-8"> is getting ignored? I don't get it.

Marvin_Martiano
Joomla! Intern
Joomla! Intern
Posts: 92
Joined: Fri Sep 09, 2011 12:36 pm

SOLVED: Occasional font encoding problem -- specific page and specific browser

Post by Marvin_Martiano » Mon Jun 27, 2016 8:50 am

Problem solved!

Going to the W3C validator (and choosing "validate error pages") I found that my doctype declaration was inconsistent.

Apparently Firefox was right in prioritizing the UTF8 declaration and Safari and Chrome weren't; but after correcting (using xhtml 4.01 transitional) now the problem is solved, and all tested browsers show the correct accents.


Locked

Return to “Language - Joomla! 3.x”