2

I am not sure why I am getting this error:

Exception Type: UnicodeEncodeError

Unicode error hint
The string that could not be encoded/decoded was: he Théâtre d

The full traceback is here: http://dpaste.com/686751/ (I put it in a dpaste due to it's length)

I am really confused about this because it works flawlessly on our staging and has been for a year or so now, it's finally on the live server, I copied over the database to the live server and now if I edit anything or add a new page with any sort of french accents I received the above error. I've been googling for hours with not much luck.

In my research I have found some issues with DB collation but I have tried to recreate the database as utf8_general_ci, and converted the tables respectively and still no luck. Any idea?

I should also note that the apps listed in the installed apps are one's we've developed and use for about 13 other live and large web sites on the same server and with the same types of characters.

baffled

Jeff

jeffci
  • 2,537
  • 6
  • 37
  • 59
  • I have found solution in link below: https://www.pythonanywhere.com/forums/topic/2121/ – admfotad Nov 15 '20 at 09:53
  • Does this answer your question? [UnicodeEncodeError: 'charmap' codec can't encode characters](https://stackoverflow.com/questions/27092833/unicodeencodeerror-charmap-codec-cant-encode-characters) – tripleee Sep 04 '22 at 10:21

2 Answers2

2

in model add u''

def __unicode__(self):
    return u"%s" % self.your_field
  • 2
    This does not seem to answer the question, as the question seems deeper. It would return a different exception if this were the case. – matsjoyce Oct 06 '14 at 15:26
1

maybe the servers have different library versions? afaik, the way to fix those errors is using the smart_unicode function in the unicode method in models, as mentioned here: django unicode encode/decode errors

Community
  • 1
  • 1