Mysql Insert query charset problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
poohinq
Forum Newbie
Posts: 1
Joined: Fri Oct 09, 2009 2:10 am

Mysql Insert query charset problem

Post by poohinq »

Hello,

I have my SQL server character set Set to UTF-8,
my database character-set set to UTF-8 and
t_statustype table character-set set to UTF-8

I am trying to exequte the following query:

mysql_query ("Insert into t_statustype (f_statustype_name) VALUES ('Предпроектно проучване') ")

After the execution i have "Ïðåäïðîåêòíî ïðîó÷âàíå" value in my db

if i set
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");

before execution of the query i receive th following error :
" Incorrect string value: '\xCF\xF0\xE5\xE4\xEF\xF0...' for column 'f_statustype_name' at row 1"

If i execute the query from SQL editor it works fine!

Any ideas what might be the problem?
Thank you!
wonder
Forum Newbie
Posts: 2
Joined: Fri Oct 09, 2009 2:40 am
Location: wuhan

Re: Mysql Insert query charset problem

Post by wonder »

please debug and get the exact value before executing mysql_query() function;

If it is correct, try to check the language package you use.

good luck
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: Mysql Insert query charset problem

Post by Griven »

Post Reply