Page 1 of 1

MySQL character problem

Posted: Wed May 13, 2009 9:17 am
by LDusan
Hi all, I am really having a problem with this one.

I am using utf_8 encoding and the problem is that when i enter some of the characters from serbian language (like ŠĐĆĆ..) in any varchar field in any MySQL table (using phpmyadmin), the page just doesn't recognize these and doesn't display them right on page when I do some query.

A friend of mine told me to use form for data entry, so I did that and it works fine, but now the characters in the database are not ok when I view it with phpmyadmin, so it's unusable if I want to, let's say send an email containing the data.

Is there any solution to this?

Any kind of help is greatly appreciated.

Re: MySQL character problem

Posted: Wed May 13, 2009 10:40 am
by Eran
You need to force UTF encoding for the database connection. Make sure the following two lines are in your mysql configuration file:

Code: Select all

default-character-set=utf8
skip-character-set-client-handshake
If you don't have access to it, you should run the following queries before communicating with the database:

Code: Select all

SET CHARACTER SET 'utf8'
SET NAMES 'utf8'

Re: MySQL character problem

Posted: Wed May 13, 2009 11:55 am
by LDusan
Thanks for the quick reply, that was GREAT!!! Saved me a lot of time, thanks a lot!!!