if available, use iconv because it requires less memory (fixes bug 21809) (follow up to r55768 and r55843)
This commit is contained in:
parent
099f21929b
commit
1ff67403c8
1 changed files with 7 additions and 1 deletions
|
|
@ -251,7 +251,13 @@ class DjVuImage {
|
|||
wfProfileOut( 'djvutxt' );
|
||||
if( $retval == 0) {
|
||||
# Get rid of invalid UTF-8, strip control characters
|
||||
$txt = UtfNormal::cleanUp( $txt );
|
||||
if( is_callable( 'iconv' ) ) {
|
||||
wfSuppressWarnings();
|
||||
$txt = iconv( "UTF-8","UTF-8//IGNORE", $txt );
|
||||
wfRestoreWarnings();
|
||||
} else {
|
||||
$txt = UtfNormal::cleanUp( $txt );
|
||||
}
|
||||
$txt = preg_replace( "/[\013\035\037]/", "", $txt );
|
||||
$txt = htmlspecialchars($txt);
|
||||
$txt = preg_replace( "/\((page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*\"([^<]*?)\"\s*|)\)/s", "<PAGE value=\"$2\" />", $txt );
|
||||
|
|
|
|||
Loading…
Reference in a new issue