Merge "Cleanup a bunch of tests and add todos"
[lhc/web/wiklou.git] / includes / media / DjVuImage.php
index 7196106..e1e7992 100644 (file)
@@ -3,7 +3,7 @@
  * DjVu image handler.
  *
  * Copyright © 2006 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -323,7 +323,9 @@ EOR;
 
        function pageTextCallback( $matches ) {
                # Get rid of invalid UTF-8, strip control characters
-               return '<PAGE value="' . htmlspecialchars( UtfNormal::cleanUp( $matches[1] ) ) . '" />';
+               $val = htmlspecialchars( UtfNormal::cleanUp( stripcslashes( $matches[1] ) ) );
+               $val = str_replace( array( "\n", '�' ), array( '&#10;', '' ), $val );
+               return '<PAGE value="' . $val . '" />';
        }
 
        /**