How to encode UTF8 filename for HTTP headers? (Python, Django)

前端 未结 6 837
温柔的废话
温柔的废话 2020-11-28 04:18

I have problem with HTTP headers, they\'re encoded in ASCII and I want to provided a view for downloading files that names can be non ASCII.

response[\'Cont         


        
6条回答
  •  眼角桃花
    2020-11-28 04:45

    This is a FAQ.

    There is no interoperable way to do this. Some browsers implement proprietary extensions (IE, Chrome), other implement RFC 2231 (Firefox, Opera).

    See test cases at http://greenbytes.de/tech/tc2231/.

    Update: as of November 2012, all current desktop browsers support the encoding defined in RFC 6266 and RFC 5987 (Safari >= 6, IE >= 9, Chrome, Firefox, Opera, Konqueror).

提交回复
热议问题