DISQUS

Django Aware: UnicodeDecodeError Exception Fix On Templates

  • sean · 1 year ago
    wow, this is another problem i'm trying to deal with!
    thanks
  • Jesse Legg · 1 year ago
    I don't understand this problem. You shouldn't have to go through all that work just to render a template with Spanish characters. Are the Spanish Characters hard-coded into the template or coming from a database? I'm really curious why would be getting this exception and Django couldn't handle it alone.
  • Brian · 1 year ago
    This was a render_to_response with Spanish chars in the template. Nothing coming out of the database.
  • Brian · 1 year ago
    In this case I have a template with Spanish characters. Nothing was coming out of the database with Spanish chars.
  • Pigletto · 1 year ago
    I'm also not sure what problem did you have.
    For me seems that your editor (that you created template with) uses iso-8859-1 instead of utf-8.
    Or maybe you had just a problem how to determine encoding and how to convert it to utf-8?
  • Brian · 1 year ago
    It was one of those cases where I outsourced the development for a static page. My static pages all inherit from my base.html, which does do some db queries. The page was emailed to me, I saved it, and boom...it didn't work. I searched around for the answer and found that many people had this problem, but all I found was about using __unicode__ instead of __str__ for db stuff. This was not the problem I had. The solution to my issues was solved by what I described above.