aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authordirkf <[email protected]>2023-11-28 17:26:37 +0000
committerdirkf <[email protected]>2023-11-29 22:08:01 +0000
commit427472351ce6b2fcf5bb35dde32bf9ee5beddd89 (patch)
treecf21cef322052923b1189c12fe00e99681a5748e
parentc6538ed323409707fc73e81fb7c93bc62ad11ac1 (diff)
downloadyoutube-dl-427472351ce6b2fcf5bb35dde32bf9ee5beddd89.tar.gz
youtube-dl-427472351ce6b2fcf5bb35dde32bf9ee5beddd89.zip
[utils] Make restricted filenames ignore characters in Unicode categories Mark, Other
Resolves #32629
-rw-r--r--youtube_dl/utils.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 443d2609c..61b94d84c 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2121,7 +2121,8 @@ def sanitize_filename(s, restricted=False, is_id=False):
if restricted and (char in '!&\'()[]{}$;`^,#' or char.isspace()):
return '_'
if restricted and ord(char) > 127:
- return '_'
+ return '' if unicodedata.category(char)[0] in 'CM' else '_'
+
return char
# Replace look-alike Unicode glyphs