Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Fix UnicodeEncodeError for long course names #43

Open
morenopc opened this issue Jan 30, 2015 · 0 comments
Open

Fix UnicodeEncodeError for long course names #43

morenopc opened this issue Jan 30, 2015 · 0 comments

Comments

@morenopc
Copy link

I'm coming from a fresh Aspen release (OPENEDX_RELEASE=aspen.1) installation of the edX Full Stack on a single Ubuntu 12.04 64-bit at AWS E2 and after restore some courses I decided to generate some certificates. As the courses are in Portuguese most of the students and course names have non-ascii characters that should be decode using utf-8.

So I can see the decode method has been called (.decode('utf-8')) but for long course names it seems to called twice raising an UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128) error.

My solution (after pull the last commits) was remove the .decode('utf-8') method ESOedX@48aa56e#diff-dca6aff9cafd628c46cf3346375d02a3R1170 (please check my commit) but I'm not sure if it's the best solution. If yes I can make a pull request.

After pull the last commits from master I got this error below which I solved removing .decode('utf-8') from COURSE_LONG=self.long_course line 1170.

/edx/app/edxapp/edx-platform$ sudo less /edx/var/log/supervisor/certstderr.log

Traceback (most recent call last):
  File "/edx/app/certs/certificates/certificate_agent.py", line 198, in <module>
    main()
  File "/edx/app/certs/certificates/certificate_agent.py", line 130, in main
    download_url) = cert.create_and_upload(name.encode('utf-8'), grade=grade, designation=designation)
  File "/edx/app/certs/certificates/gen_cert.py", line 313, in create_and_upload
    designation=designation,)
  File "/edx/app/certs/certificates/gen_cert.py", line 385, in _generate_certificate
    designation,
  File "/edx/app/certs/certificates/gen_cert.py", line 576, in _generate_v1_certificate
    self.course, self.long_course)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7: ordinal not in range(128)
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