I have table with Persian data and utf8_general_ci collection and with php program i was inserted data to database.
now i have new program with python – django and want view data but all data is bad view like پست
why? and what i can do for solve this problem?
ps: when i insert new data with python, all things is correct and view correctly.
If you’re running into the problem where unicode items in your Django / MySQL project are displayed as question marks, here’s the likely problem and solution, found in this django-users thread:
The likely problem is that your MySQL encoding is set to latin1, as opposed to utf8. You can check this via:
You’ll probably see:
You want this to be uft8. To modify it, edit your my.conf file ( /etc/mysql/my.conf on ubuntu ), adding the following lines to the appropriate sections:
Now restart mysql:
And alter your existing tables to use the utf8 encoding:
alter table your_table_name convert to character set utf8;
And that should do it.