Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Report a bug #7

Open
jiangtiandao opened this issue Mar 24, 2018 · 2 comments
Open

Report a bug #7

jiangtiandao opened this issue Mar 24, 2018 · 2 comments

Comments

@jiangtiandao
Copy link

jiangtiandao commented Mar 24, 2018

Course url
https://www.icourse163.org/learn/NUDT-1001615004?tid=1001692001

Traceback (most recent call last):
File "icourse163-dl.py", line 215, in
main()
File "icourse163-dl.py", line 133, in main
lesson_name = model.clean_filename(model.raw_unicode_escape(lesson_re.group("lesson_name")))
File "D:\Users\John\Documents\GitHub\cn-mooc-dl\model\download.py", line 59, in raw_unicode_escape
return string.encode('utf-8').decode('unicode_escape').encode('gbk', 'ignore').decode('gbk', 'ignore')
UnicodeDecodeError: 'unicodeescape' codec can't decode byte 0x5c in position 36: \ at end of string

@jiangtiandao
Copy link
Author

是末尾的 \ 在 Unicode escape 解码时 出错了

@jiangtiandao
Copy link
Author

jiangtiandao commented Apr 1, 2018

def raw_unicode_escape(string: str) -> str:
    return string.rstrip('\\').encode('utf-8').decode('unicode_escape').encode('gbk', 'ignore').decode('gbk', 'ignore')

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant