URL-encode the content-disposition suggested filename for XML export data.
[lhc/web/wiklou.git] / includes / StreamFile.php
index 949422d..8ecaa4f 100644 (file)
@@ -7,7 +7,7 @@ function wfStreamFile( $fname ) {
        if ( !$stat ) {
                header( 'HTTP/1.0 404 Not Found' );
                header( 'Cache-Control: no-cache' );
-               header( 'Content-Type: text/html' );
+               header( 'Content-Type: text/html; charset=utf-8' );
                $encFile = htmlspecialchars( $fname );
                $encScript = htmlspecialchars( $_SERVER['SCRIPT_NAME'] );
                echo "<html><body>
@@ -31,6 +31,9 @@ function wfStreamFile( $fname ) {
                header('Content-type: application/x-wiki');
        }
 
+       global $wgContLanguageCode;
+       header( "Content-Disposition: inline;filename*=utf-8'$wgContLanguageCode'" . urlencode( basename( $fname ) ) );
+
        if ( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
                $modsince = preg_replace( '/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE'] );
                $sinceTime = strtotime( $modsince );
@@ -69,4 +72,4 @@ function wfGetType( $filename ) {
        }
 }
 
-?>
+