google-code-backups / get-simple-cms

Automatically exported from code.google.com/p/get-simple-cms
GNU General Public License v3.0
0 stars 0 forks source link

IL8n charachters not parsed properly by het_header #277

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Using <?php get_header(); ?> I realized that German Umlaute üöä get parsed 
as &amp;uuml; instead of &uuml;
See meta description there.
Calling <?php get_page_meta_desc(); ?> on the other hand works fine.

Original issue reported on code.google.com by MichaelS...@gmail.com on 1 Jan 2012 at 7:43

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r616.

Original comment by MichaelS...@gmail.com on 1 Jan 2012 at 8:34

GoogleCodeExporter commented 8 years ago
After this change (which has caused issue 283), lines 277 to 294 in 
get_header() are "doing nothing": variables $description and $keywords are 
given values, but not used later.
The excerpt that was inserted into the meta description (when the page's 
description field is empty) is no longer generated.

Original comment by carnav on 28 Jan 2012 at 9:55

GoogleCodeExporter commented 8 years ago
This issue is still happening with get_header(), and now also with 
get_page_meta_desc() and get_page_meta_keywords(), since r645.

á ä 
are encoded as:
&aacute; &auml;
instead of:
á ä
(in meta desc and keywords)

I suggest you make some change in function encode_quotes(), which is -only- 
called those 3 functions above. 

admin/inc/basic.php, line 471, 
Replace:
 $text = htmlspecialchars($text, ENT_QUOTES);
by:
 $text = str_replace('"', '"', str_replace("'", ''', $text) );

This way, encode_quotes will only *encode quotes* :-), both single and double 
ones, which are the ones we want to avoid, as we're enclosing the text between 
quotes (mostly double quotes, but just in case the template creator is using 
single ones, better encode those too)

Original comment by carnav on 29 Jan 2012 at 10:14

GoogleCodeExporter commented 8 years ago
I update my suggestion. Instead of those str_replace, continue using 
htmlspecialchars, but with a couple extra parameters. The patch to 
encode_quotes would be:

admin/inc/basic.php, line 471, 
Replace:
 $text = htmlspecialchars($text, ENT_QUOTES);
by:
 $text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', false);

It does the same, encodes both ' and " but not &

Original comment by carnav on 2 Feb 2012 at 4:55