Topic on Extension talk:Categorize

Encoding error when rendering umlauts

2
Nakohdo (talkcontribs)

The German localization is rendered ok, but there seems to be an encoding error with the category names from LocalSettings.php (the file is saved as UTF-8). I suppose the culprit is somewhere in the JavaScript code.

I'm using Categorize MW1.18 r92462

Nakohdo (talkcontribs)

The culprit seems to be the utf8_encode() function in Categorize.hooks.php, e.g.:

 $l__label_value_to_print = utf8_encode(str_replace("_"," ",$l__label_value));

$l__label_value is read correctly from LocalSettings.php but $l__label_value_to_print gets corrupted.

"Please note that utf8_encode only converts a string encoded in ISO-8859-1 to UTF-8. A more appropriate name for it would be 'iso88591_to_utf8'. If your text is not encoded in ISO-8859-1, you do not need this function. If your text is already in UTF-8, you do not need this function. In fact, applying this function to text that is not encoded in ISO-8859-1 will most likely simply garble that text." http://php.net/manual/de/function.utf8-encode.php

Removing that function does resolve the issue, only the AJAX suggestion still doesn't work with umlauts.

Reply to "Encoding error when rendering umlauts"