It's very nice having a fallback iconv() function, but we should take into account...
authorPlatonides <platonides@users.mediawiki.org>
Wed, 28 Jul 2010 13:51:42 +0000 (13:51 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Wed, 28 Jul 2010 13:51:42 +0000 (13:51 +0000)
This fixes the two phpunit tests of Revision of Legacy encoding when native iconv is not available in php.

Allow js_unescape to take advantage of our wrapper, too. (although that function seems completely unused...)

includes/AjaxFunctions.php
includes/GlobalFunctions.php

index 04572b4..c801814 100644 (file)
@@ -49,7 +49,7 @@ function js_unescape( $source, $iconv_to = 'UTF-8' ) {
        }
 
        if ( $iconv_to != "UTF-8" ) {
-               $decodedStr = iconv( "UTF-8", $iconv_to, $decodedStr );
+               $decodedStr = iconv( "utf-8", $iconv_to, $decodedStr );
        }
 
        return $decodedStr;
index d0c3a42..b61a151 100644 (file)
@@ -25,6 +25,7 @@ if( !function_exists('iconv') ) {
        # Assume will only ever use utf-8 and iso-8859-1.
        # This will *not* work in all circumstances.
        function iconv( $from, $to, $string ) {
+               if ( substr( $to, -8 ) == '//IGNORE' ) $to = substr( $to, 0, strlen( $to ) - 8 );
                if(strcasecmp( $from, $to ) == 0) return $string;
                if(strcasecmp( $from, 'utf-8' ) == 0) return utf8_decode( $string );
                if(strcasecmp( $to, 'utf-8' ) == 0) return utf8_encode( $string );
@@ -407,6 +408,7 @@ function wfLogDBError( $text ) {
  */
 function wfErrorLog( $text, $file ) {
        if ( substr( $file, 0, 4 ) == 'udp:' ) {
+               # Needs the sockets extension
                if ( preg_match( '!^(tcp|udp):(?://)?\[([0-9a-fA-F:]+)\]:(\d+)(?:/(.*))?$!', $file, $m ) ) {
                        // IPv6 bracketed host
                        $protocol = $m[1];