Index: trunk/phase3/includes/DjVuImage.php |
— | — | @@ -250,6 +250,9 @@ |
251 | 251 | $txt = wfShellExec( $cmd, $retval ); |
252 | 252 | wfProfileOut( 'djvutxt' ); |
253 | 253 | if( $retval == 0) { |
| 254 | + # Get rid of invalid UTF-8, strip control characters |
| 255 | + $txt = iconv( "UTF-8","UTF-8//IGNORE", $txt ); |
| 256 | + $txt = preg_replace( "/[\013\035\037]/", "", $txt ); |
254 | 257 | $txt = htmlspecialchars($txt); |
255 | 258 | $txt = preg_replace( "/\((page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*\"([^<]*?)\"\s*|)\)/s", "<PAGE value=\"$2\" />", $txt ); |
256 | 259 | $txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n"; |