Difference between revisions of "Extension talk:SearchLog.php"

From Organic Design wiki
(New page: == Problem with UTF8 chars == The sea...)
 
(Escaping UTF-8 characters)
Line 2: Line 2:
  
 
The search log incorrectly displays UTF-8 characters (as black diamonds with question sign inside). Could you help to fix that?
 
The search log incorrectly displays UTF-8 characters (as black diamonds with question sign inside). Could you help to fix that?
 +
: The UTF-8 is converted automatically when in the source code of an html page, to stop it rendering you need to escape wither the & or the # with its UTF-8 code e.g.
 +
:To display ¼ as ¼
 +
:you can use a regular expression to convert the # into # --[[User:Sven|Sven]] 11:32, 8 February 2008 (NZDT)
 +
:At about line 95 if you change the for loop to;
 +
{{code|<php>
 +
  foreach ($total as $k => $v) {
 +
                                $k = preg_replace("/#/", "&#35;", $k);
 +
                                $table .= "<tr><td>$k</td><td>$v</td></tr>\n";
 +
                              }
 +
</php>
 +
}}
 +
that should now show the raw UTF-8 characters --[[User:Sven|Sven]] 11:32, 8 February 2008 (NZDT)

Revision as of 22:32, 7 February 2008

Problem with UTF8 chars

The search log incorrectly displays UTF-8 characters (as black diamonds with question sign inside). Could you help to fix that?

The UTF-8 is converted automatically when in the source code of an html page, to stop it rendering you need to escape wither the & or the # with its UTF-8 code e.g.
To display ¼ as &#188;
you can use a regular expression to convert the # into &#35; --Sven 11:32, 8 February 2008 (NZDT)
At about line 95 if you change the for loop to;
{{{1}}}

that should now show the raw UTF-8 characters --Sven 11:32, 8 February 2008 (NZDT)