Hello friends this is something weird... when i insert some italian characters in mysql. like è ò à ù ì

i got this in database è ò à ù ì

my table charset is latin1.

thanks in advance. :)

Hello friends this is something weird... when i insert some italian characters in mysql. like è ò à ù ì

i got this in database è ò à ù ì

my table charset is latin1.

thanks in advance. :)

When you insert accented characters in a field of a MySQL table and you don't have configured the system correctly, you get the strange characters such as ì or è etc..

To solve this:

1. Add a few lines of code in the file called my.cnf (generally under /etc/mysql) under the [mysqld] section:
collation_server=utf8_unicode_ci
character_set_server=utf8

Optionally you can also add the line:
skip-character-set-client-handshake
to enforce using of utf8 encoding in db.

2. Restart mysql.

3. Test the values of the character set system variables by digit from shell (terminal):

mysql> SHOW VARIABLES LIKE 'character_set%';

Do this statement, should return this:

Variable_name Value

character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server utf8
character_set_system utf8
character_sets_dir /usr/share/mysql/charsets/

8 rows in set (0.00 sec

Now you have correctly set MySQL character set!

Alternatively you may want to change the column type to a blob or char. But for a char type you will need to specify the maximum length of storage input. Also the type of character set you set a table to be can also make a difference.

Be a part of the DaniWeb community

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