My Django version is 2.0, Python 3. Does anyone know how to solve the problem of django_easy_pdf does not support the unicode text?

class GradeIndexTemplateView(TemplateView):
template_name = 'hello.html'

def course_student_gradePDF(request, course, student):
  resp = HttpResponse(content_type='application/pdf')
  cid = request.GET.get('course', course)
  sid = request.GET.get('student', student)
  cursor = connections['moodle'].cursor()
  cursor.execute(MAIN_QUERY % (cid, sid))
  grade = dictfetchall(cursor)
  cursor.execute(STUDENT_INFO_QUERY % student)
  stu = dictfetchall(cursor)
  context = dict({'grade': grade, 'stu': stu})
  result = generate_pdf('hello.html', file_object=resp, context=context)
  # Render the HTML template index.html with the data in the context 
  return result


0 Answers