From: ThomasV Date: Thu, 3 Sep 2009 14:19:24 +0000 (+0000) Subject: get rid of invalid UTF8, strip control characters X-Git-Tag: 1.31.0-rc.0~39960 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=d8fa790eb2115207f19ac011eb92d755bce764e3;p=lhc%2Fweb%2Fwiklou.git get rid of invalid UTF8, strip control characters --- diff --git a/includes/DjVuImage.php b/includes/DjVuImage.php index 406878d076..c49971e1c4 100644 --- a/includes/DjVuImage.php +++ b/includes/DjVuImage.php @@ -250,6 +250,9 @@ class DjVuImage { $txt = wfShellExec( $cmd, $retval ); wfProfileOut( 'djvutxt' ); if( $retval == 0) { + # Get rid of invalid UTF-8, strip control characters + $txt = iconv( "UTF-8","UTF-8//IGNORE", $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", "", $txt ); $txt = "\n\n\n" . $txt . "\n\n";