0

I am trying to create a report from database data. While in my local database I have no problems, when I run it in prod I am getting this error 'ascii' codec can't decode byte 0xe9 in position 5: ordinal not in range(128)

My database has utf8_general encoding both in my local database and in my prod database, so I don't understand what the problem is. My data is in spanish so this error is thrown when it finds special characters (á, é, í...)

EDIT: I checked the results in both test and prod. To give an example, this is how the result is showing:

Test: almacén y farmacia

Prod: almac\xe9n y farmacia

plasmy
  • 99
  • 3
  • 9
  • 32
  • Just for curiosity : your prod database was originally utf8 or did you changed it after creation? If so it is possible that your existing tables stayed with the old encoding – Sebastien D Feb 12 '18 at 23:45
  • Yes they are the same. The thing is, everything I was doing before was working as intended. I even created text files with that data without any problems. Now I'm trying to create a PDF file and it gives me that error. – plasmy Feb 12 '18 at 23:51
  • I meant to say I didn't change anything. – plasmy Feb 12 '18 at 23:51
  • I should add, I am trying to render an HTML template (Jinja) and turn it into a PDF, which seems to be where the problem is. – plasmy Feb 13 '18 at 00:05
  • Can you provide the code where the exception throw? – stamaimer Feb 13 '18 at 03:18
  • I managed to fix the problem by adding the charset: utf8 parameter to my pymysql connection string. Thank you for your answer! – plasmy Feb 13 '18 at 14:17

0 Answers0