Index: trunk/phase3/includes/normal/UtfNormal.php |
— | — | @@ -72,6 +72,13 @@ |
73 | 73 | * @return string a clean, shiny, normalized UTF-8 string |
74 | 74 | */ |
75 | 75 | static function cleanUp( $string ) { |
| 76 | + if( extension_loaded( 'iconv' ) ) { |
| 77 | + wfSuppressWarnings(); |
| 78 | + $ret = iconv( "UTF-8","UTF-8//IGNORE", $string ); |
| 79 | + wfRestoreWarnings(); |
| 80 | + return $ret; |
| 81 | + } |
| 82 | + |
76 | 83 | if( NORMALIZE_ICU ) { |
77 | 84 | # We exclude a few chars that ICU would not. |
78 | 85 | $string = preg_replace( |
Index: trunk/phase3/includes/DjVuImage.php |
— | — | @@ -251,13 +251,7 @@ |
252 | 252 | wfProfileOut( 'djvutxt' ); |
253 | 253 | if( $retval == 0) { |
254 | 254 | # Get rid of invalid UTF-8, strip control characters |
255 | | - if( is_callable( 'iconv' ) ) { |
256 | | - wfSuppressWarnings(); |
257 | | - $txt = iconv( "UTF-8","UTF-8//IGNORE", $txt ); |
258 | | - wfRestoreWarnings(); |
259 | | - } else { |
260 | | - $txt = UtfNormal::cleanUp( $txt ); |
261 | | - } |
| 255 | + $txt = UtfNormal::cleanUp( $txt ); |
262 | 256 | $txt = preg_replace( "/[\013\035\037]/", "", $txt ); |
263 | 257 | $reg = <<<EOR |
264 | 258 | /\(page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*" |