aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorAdam Thalhammer <s3544305@student.rmit.edu.au>2016-05-02 13:21:39 +1000
committerAdam Thalhammer <s3544305@student.rmit.edu.au>2016-05-02 13:21:39 +1000
commit79a2e94e79e65cdf4898bc2dedb6a1bb4ca9af3c (patch)
tree97cd368a2089b073d2f0c1638bc66bd75fe11443 /youtube_dl
parent686cc8963441c37105c0447f31c5ea21405be05a (diff)
Instead of replacing accented characters with an underscore when sanitizing file names in restricted mode, replace them with their non-accented equivalents fixes #9347
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 7bcc85e2b..f74f62268 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -14,8 +14,8 @@ import email.utils
import errno
import functools
import gzip
-import itertools
import io
+import itertools
import json
import locale
import math
@@ -24,8 +24,8 @@ import os
import pipes
import platform
import re
-import ssl
import socket
+import ssl
import struct
import subprocess
import sys
@@ -365,6 +365,11 @@ def sanitize_filename(s, restricted=False, is_id=False):
Set is_id if this is not an arbitrary string, but an ID that should be kept if possible
"""
def replace_insane(char):
+ accents = dict(zip('ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ',
+ itertools.chain('AAAAAA', ['AE'], 'CEEEEIIIIDNOOOOOOUUUUYP', ['ss'],
+ 'aaaaaa', ['ae'], 'ceeeeiiiionoooooouuuuypy')))
+ if restricted and char in accents:
+ return accents[char]
if char == '?' or ord(char) < 32 or ord(char) == 127:
return ''
elif char == '"':