Revisión | 70fa3802880f914bd6b33bb3bae465a06a62151a (tree) |
---|---|
Tiempo | 2014-07-13 05:02:56 |
Autor | umorigu <umorigu@gmai...> |
Commiter | umorigu |
BugTrack2/354: Implement RFC 6266 to support non-ASCII filename of Attach
* RFC 6266: Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol
* RFC2231: MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations
* RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters
@@ -711,13 +711,13 @@ EOD; | ||
711 | 711 | break; |
712 | 712 | } |
713 | 713 | } |
714 | - $filename = htmlsc($filename); | |
714 | + $utf8filename = mb_convert_encoding($filename, 'UTF-8', 'auto'); | |
715 | 715 | |
716 | 716 | ini_set('default_charset', ''); |
717 | 717 | mb_http_output('pass'); |
718 | 718 | |
719 | 719 | pkwk_common_headers(); |
720 | - header('Content-Disposition: inline; filename="' . $filename . '"'); | |
720 | + header('Content-Disposition: inline; filename="' . $filename . '"; filename*=utf-8\'\'' . rawurlencode($utf8filename)); | |
721 | 721 | header('Content-Length: ' . $this->size); |
722 | 722 | header('Content-Type: ' . $this->type); |
723 | 723 |
@@ -420,12 +420,12 @@ function plugin_ref_action() | ||
420 | 420 | break; |
421 | 421 | } |
422 | 422 | } |
423 | - $file = htmlsc($filename); | |
423 | + $utf8filename = mb_convert_encoding($filename, 'UTF-8', 'auto'); | |
424 | 424 | $size = filesize($ref); |
425 | 425 | |
426 | 426 | // Output |
427 | 427 | pkwk_common_headers(); |
428 | - header('Content-Disposition: inline; filename="' . $filename . '"'); | |
428 | + header('Content-Disposition: inline; filename="' . $filename . '"; filename*=utf-8\'\'' . rawurlencode($utf8filename)); | |
429 | 429 | header('Content-Length: ' . $size); |
430 | 430 | header('Content-Type: ' . $type); |
431 | 431 | @readfile($ref); |