I have a problem which I think it is related to Python, however I may be wrong. I am writing a database using wx.Python and MySQLdb. My problem is that when I want to send some string which contains accents to the MySQL database (for instance, 'Empordà') it is inserted with strange characters and when I run a query in the database I see something like '?' instead of the character with an accent ('à' in thos case). However, if I insert the string manually into the database, using INSERT or UPDATE it is inserted properly. I declare the coding in my python script as

#! /usr/bin/env python
# -*- coding: latin-1 -*-

Further useful info, when I run

SHOW VARIABLES LIKE 'character_set%';

in the MySQL database I get

| Variable_name            | Value                      |
| character_set_client     | latin1                     |
| character_set_connection | latin1                     |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | latin1                     |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |

Can anyone help?


Could anyone help, please? It is very important for me to have accents and other latin characters properly handled, as in Catalan/Spanish we use lots of them!
Thank you so much!


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.