Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode character encoding error #7

Closed
YoBii opened this issue Aug 10, 2018 · 11 comments
Closed

Unicode character encoding error #7

YoBii opened this issue Aug 10, 2018 · 11 comments

Comments

@YoBii
Copy link
Contributor

YoBii commented Aug 10, 2018

Hey man, appreciate your work. Unfortunately there seems to be an error with the encoding of unicode characters like ä,ö,ü when the script attempts to fetch course id and name.

>> Logging into "$someURL"... INFO: No need to login :)
Done!
>> Retrieving echo360 Course Info...  36/36 videos Done!
Traceback (most recent call last):
  File ".\echo360.py", line 243, in <module>
    main()
  File ".\echo360.py", line 208, in main
    downloader.download_all()
  File "D:\Downloads\echo360-master\echo360-master\echo360\downloader.py", line 174, in download_all
    self._course.course_id, self._course.course_name).strip())
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 6: ordinal not in range(128)
@soraxas
Copy link
Owner

soraxas commented Aug 26, 2018

Hi @YoBii thanks for your reporting and PR! I did not consider unicode encoding at all before so thanks for letting me know.

@soraxas
Copy link
Owner

soraxas commented Nov 12, 2018

fixed in #8

@soraxas soraxas closed this as completed Nov 12, 2018
@Aposke
Copy link

Aposke commented Apr 3, 2020

Still have this error using 1.4, but the last line is slightly different:

Traceback (most recent call last):
File "echo360.py", line 269, in
main()
File "echo360.py", line 223, in main
downloader.download_all()
File "/home/liquidcrystal/Desktop/Hilfskraft/echo360-1.3/echo360/downloader.py", line 187, in download_all
title = "Lecture {} [{}]".format(lecture_number + 1, video.title)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 17: ordinal not in range(128)

Got this when trying to download a course which had the German letter "ü" in the title.

@soraxas
Copy link
Owner

soraxas commented Apr 7, 2020

@Aposke This problem probably occurs because of python2's encoding issues.

Can you try to pull the latest commit to see if it fixes it?

On a side note, from your log /home/liquidcrystal/Desktop/Hilfskraft/echo360-1.3/echo360/downloader.py it seems like you aren't using 1.4 previously as you stated

@Aposke
Copy link

Aposke commented Apr 7, 2020

Hi, thanks for the response and commit! I checked 1.4 first and got the same error, so I tried 1.3 instead, thinking maybe something broke inbetween the updates (since 1.3 was the one that supposedly fixed the UTF encoding).

Upon running echo360 again with the changes from the latest commit, I get this:

File "/home/liquidcrystal/Desktop/Hilfskraft/echo360-1.4/echo360/downloader.py", line 170, in download_all
self._course.course_id, self._course.course_name).strip())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128)

@soraxas
Copy link
Owner

soraxas commented Apr 9, 2020

Hi! Sorry are you sure you are using the latest commit (i.e. the master branch)? The download link is https://github.com/soraxas/echo360/archive/master.zip and it should have a folder named echo360-master

@Aposke
Copy link

Aposke commented Apr 9, 2020

Yup! I simply downloaded the new updated files manually and overwrote the old ones. I also tried using the zip you linked just now, but I'm still getting the same error.

Traceback (most recent call last):
File "echo360.py", line 269, in
main()
File "echo360.py", line 223, in main
downloader.download_all()
File "/home/liquidcrystal/Desktop/Hilfskraft/echo360-master/echo360/downloader.py", line 170, in download_all
self._course.course_id, self._course.course_name).strip())
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: ordinal not in range(128)

@soraxas
Copy link
Owner

soraxas commented Apr 9, 2020

Hi apology about all the madness with the python2 encoding issues. Can you try to run with the latest commit?

@Aposke
Copy link

Aposke commented Apr 14, 2020

Yet another decoding error:

Traceback (most recent call last):
File "echo360.py", line 269, in
main()
File "echo360.py", line 223, in main
downloader.download_all()
File "/home/liquidcrystal/.local/share/Trash/files/echo360-master/echo360/downloader.py", line 170, in download_all
self._course.course_id, self._course.course_name).strip())
File "/home/liquidcrystal/.local/share/Trash/files/echo360-master/echo360/course.py", line 76, in course_name
return self._course_name.decode('utf-8').encode('utf-8')
File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 6: ordinal not in range(128)

If you want, I can PM you the URL for the course and you can do some bugtesting yourself? I don't mind doing it, but going through me every time might be a pretty slow process.

@soraxas
Copy link
Owner

soraxas commented Apr 14, 2020

@Aposke Yes that probably would make this process easier

@soraxas
Copy link
Owner

soraxas commented Apr 23, 2020

fixed in 8d19dae.

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

No branches or pull requests

3 participants