dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5a60249
)
get rid of invalid UTF8, strip control characters
author
ThomasV
<thomasv@users.mediawiki.org>
Thu, 3 Sep 2009 14:19:24 +0000
(14:19 +0000)
committer
ThomasV
<thomasv@users.mediawiki.org>
Thu, 3 Sep 2009 14:19:24 +0000
(14:19 +0000)
includes/DjVuImage.php
patch
|
blob
|
history
diff --git
a/includes/DjVuImage.php
b/includes/DjVuImage.php
index
406878d
..
c49971e
100644
(file)
--- a/
includes/DjVuImage.php
+++ b/
includes/DjVuImage.php
@@
-250,6
+250,9
@@
class DjVuImage {
$txt = wfShellExec( $cmd, $retval );
wfProfileOut( 'djvutxt' );
if( $retval == 0) {
$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", "<PAGE value=\"$2\" />", $txt );
$txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";
$txt = htmlspecialchars($txt);
$txt = preg_replace( "/\((page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*\"([^<]*?)\"\s*|)\)/s", "<PAGE value=\"$2\" />", $txt );
$txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";