Reputation: 6107
I have a database that uses a UTF-8 charset encoding. When I use the shell prompt to run mysql and select rows from tables, I can see the characters just fine (Frédéric Bélier
). However, when running my django project and viewing a page in browser the field shows up as Frédéric Bélier
. The HTML page as a charset meta tag of UTF-8.
When opening my views file (and template file) in Gedit I see that the charset is set to UTF-8 as well. However, when I run file -i views.py
the output is views.py: text/x-java; charset=us-ascii / ASCII Java program text, with CRLF line terminators
.
Any advices on what can be wrong and how it can be fixed?
Upvotes: 2
Views: 810
Reputation: 1044
I am not a Django expert but perhaps it has something to do with a
HTTP Header or Document Header
A Django configuration. In Python a string is not necessarily unicode (unlike .NET for example)
My gut tells me that 2 in the probable situation.
Upvotes: 1