[Mediawiki-l] parser function + multibyte characters = blank article?

Daniel Barrett danb at VistaPrint.com
Wed Apr 13 16:42:55 UTC 2011

I'm having a problem with a parser function that reads a string from a database and displays it on a wiki page. The basic structure is this:

       static function myParserFunction($parser, $arg) {
         $value = getFromDatabase();
         return $value;

Everything works great unless the value contains a multibyte character. In this case, after the parser function returns its value, something else goes wrong internal to MediaWiki and the ENTIRE content area of the article gets blanked. No PHP errors appear in the logs.

Here's another clue. If my parser function echoes the value instead of returning it:

       static function myParserFunction($parser, $arg) {
         $value = getFromDatabase();
         echo $value;
         return 'dummy';

then the value appears without a problem in the browser. So the value is correctly read from the database, and correctly returned by the parser function, but it fouls up something downstream.

Does anyone know what's going on, or have suggestions on how to debug further?


More information about the MediaWiki-l mailing list