Closed atvcaptain closed 1 year ago
I wonder which Python build you have.
This is probably happening because your Python is built without wide character support. I wondered if that would still be a problem and it appears that you have helpfully provided the answer. There is a known solution, though:
--- old/youtube_dl/casefold.py
+++ new/youtube_dl/casefold.py
@@ -1639,7 +1639,11 @@
1E921; C; 1E943; # ADLAM CAPITAL LETTER SHA
'''
-_parse_unichr = lambda s: compat_chr(int(s, 16))
+def _parse_unichr(s):
+ try:
+ return compat_chr(int(s, 16))
+ except ValueError:
+ return ('\\U' + ('0000000' + s)[-8:]).decode('unicode-escape')
_map = dict(
(_parse_unichr(from_), ''.join(map(_parse_unichr, to_.split(' '))))
this is my legacy build python 2.7 i use openembedded build System zeus, my build with py3.9/3.10 and 3.11 have np thx for quick fix
The original version worked on my embedded 2.7.1 Python that was built 10+ years ago, so I hoped to get away without a work-around!
Actually there doesn't seem to be any significant performance difference between these three as measured by running time python test/test_compat.py
:
raise ValueError
forced in the try
suite'\\U%08x' % int(s, 16)
, again with forced ValueError
.
Checklist
Verbose log
Description
with commit https://github.com/ytdl-org/youtube-dl/commit/a874871801b8b05d06e8ffe52bed94fdfc26611e youtube-dl.bash-completion stop build