Add AJAX category management system. Includes suggestion system, dialogs for setting...
[lhc/web/wiklou.git] / includes / DjVuImage.php
index 1b8c4e4..544a455 100644 (file)
@@ -250,7 +250,9 @@ class DjVuImage {
                        $txt = wfShellExec( $cmd, $retval );
                        wfProfileOut( 'djvutxt' );
                        if( $retval == 0) {
-                               $txt = utf8_encode($txt);
+                               # Get rid of invalid UTF-8, strip control characters
+                               $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*\&quot;([^<]*?)\&quot;\s*|)\)/s", "<PAGE value=\"$2\" />", $txt  );
                                $txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";