Skip to content

Commit

Permalink
Fix UnicodeEncodeError: 'ascii' codec can't encode characters in posi…
Browse files Browse the repository at this point in the history
…tion 7-8: ordinal not in range(128) issue for long course names
  • Loading branch information
morenopc committed Jan 29, 2015
1 parent 7f0231a commit 48aa56e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gen_cert.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ def _generate_v1_certificate(
0, 0.624, 0.886)
styleOpenSans.alignment = TA_LEFT

paragraph_string = "<b><i>{0}: {1}</i></b>".format(
self.course, self.long_course.decode('utf-8'))
paragraph_string = u"<b><i>{0}: {1}</i></b>".format(
self.course, self.long_course)
paragraph = Paragraph(paragraph_string, styleOpenSans)
# paragraph.wrapOn(c, WIDTH * mm, HEIGHT * mm)
if 'PH207x' in self.course:
Expand Down Expand Up @@ -1167,7 +1167,7 @@ def _generate_verification_page(self, name, filename, output_dir, verify_uuid, d
valid_page = f.read().decode('utf-8')
valid_page = valid_page.format(
COURSE=self.course.decode('utf-8'),
COURSE_LONG=self.long_course.decode('utf-8'),
COURSE_LONG=self.long_course,
ORG=self.org.decode('utf-8'),
ORG_LONG=self.long_org.decode('utf-8'),
NAME=name.decode('utf-8'),
Expand Down

0 comments on commit 48aa56e

Please sign in to comment.