summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2014-04-04 23:00:51 +0200
committerPhilipp Hagemeister <[email protected]>2014-04-04 23:00:51 +0200
commit676eb3f2dd542be3e84780b18388253382d3e465 (patch)
treec2035c07369c1fd968404bc1074e6e1fb57b74bf /youtube_dl/utils.py
parent98b7cf1acefe398f792ca6ff4c5f84f1b7785fcb (diff)
downloadyoutube-dl-676eb3f2dd542be3e84780b18388253382d3e465.tar.gz
youtube-dl-676eb3f2dd542be3e84780b18388253382d3e465.zip
Fix unicode_escape (Fixes #2695)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 5f1f664c8..92fee966f 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
import calendar
+import codecs
import contextlib
import ctypes
import datetime
@@ -1263,9 +1264,11 @@ class PagedList(object):
def uppercase_escape(s):
+ unicode_escape = codecs.getdecoder('unicode_escape')
return re.sub(
r'\\U[0-9a-fA-F]{8}',
- lambda m: m.group(0).decode('unicode-escape'), s)
+ lambda m: unicode_escape(m.group(0))[0],
+ s)
try:
struct.pack(u'!I', 0)