summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cherrypy/lib/static.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/cherrypy/lib/static.py b/cherrypy/lib/static.py
index d806242d..70556739 100644
--- a/cherrypy/lib/static.py
+++ b/cherrypy/lib/static.py
@@ -34,9 +34,17 @@ def _make_content_disposition(disposition, file_name):
This function implements the recommendations of :rfc:`6266#appendix-D`.
See this and related answers: https://stackoverflow.com/a/8996249/2173868.
+
+ As normalization algorithm for `unicodedata` is used composed form (NFC and NKFC)
+ with compatibility equivalence criteria (NFK), so "NKFC" is the one.
+ It first applies the compatibility decomposition, followed by the canonical
+ composition. Should be displayed in the same manner, should be treated in
+ the same way by applications such as alphabetizing names or searching,
+ and may be substituted for each other.
+ See: https://en.wikipedia.org/wiki/Unicode_equivalence.
"""
ascii_name = (
- unicodedata.normalize('NFKD', file_name).
+ unicodedata.normalize('NKFC', file_name).
encode('ascii', errors='ignore').decode()
)
header = '{}; filename="{}"'.format(disposition, ascii_name)