* add a require dependency
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 18 Oct 2004 09:49:03 +0000 (09:49 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 18 Oct 2004 09:49:03 +0000 (09:49 +0000)
* allow do_html_entity_decode() to be called with different charsets during the script lifetime

includes/GlobalFunctions.php

index 276a863..303f9f0 100644 (file)
@@ -30,6 +30,7 @@ $wgTotalEdits = -1;
 require_once( 'DatabaseFunctions.php' );
 require_once( 'UpdateClasses.php' );
 require_once( 'LogPage.php' );
+require_once( 'normal/UtfNormalUtil.php' );
 
 /**
  * Compatibility functions
@@ -89,8 +90,10 @@ if ( !function_exists( 'mb_substr' ) ) {
  */
 function do_html_entity_decode( $string, $quote_style=ENT_COMPAT, $charset='ISO-8859-1' ) {
        static $trans;
-       if( !isset( $trans ) ) {
+       static $savedCharset;
+       if( !isset( $trans ) || $savedCharset != $charset ) {
                $trans = array_flip( get_html_translation_table( HTML_ENTITIES, $quote_style ) );
+               $savedCharset = $charset;
                # Assumes $charset will always be the same through a run, and only understands
                # utf-8 or default. Note - mixing latin1 named entities and unicode numbered
                # ones will result in a bad link.