00857: non english characters are shown incorrectly in the trail

Summary: non english characters are shown incorrectly in the trail
Created: 2007-01-06 10:55
Status: Closed - replied
Category: Bug
From: milosz
Assigned:
Priority: 3
Version: 2.1.27
OS: Linux/Apache2/PHP5

Description: When the trail links in the trail index page have description containing some non english characters, the trail markup behaves incorrectly. Example:

trail index contents:

* [[Page1 | strona biała]]
* [[Page2 | strona zółta]]
* [[Page3 | strona zielona]]
Page2 contents:
<<|[[TrailIndex | Spis tre&#347;ci]]|>>
looks now:
<< strona bia&amp;#322;a | Spis tre&#347;ci | strona zielona >>
should be:
<< strona bia&#322;a | Spis tre&#347;ci | strona zielona >>

Root cause

The problem is caused by function htmlspecialchars. It does not recognize &#<int>; as an html entity. Because of that & sign is converted to &amp; and the trail strings are displayed incorrectly.

Changing line

foreach(explode("\n", htmlspecialchars(@$trailpage['text'], ENT_NOQUOTES))

to:

foreach(explode("\n", @$trailpage['text'])

solves this problem, but probably causes some side effects.

Hi. I do not consider this a PmWiki bug. If your wiki is in another language like Polish, Greek or Bulgarian, you need to use a character encoding that contains all letters in that language. PmWiki has decent support for UTF-8, a universal encoding for all languages. See PmWiki.UTF-8 and Cookbook.UTF-8 for more information. --Petko July 07, 2009, at 10:23 PM