By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

Accented characters problem

P: n/a
I am trying to allow accented characters (, , ) to be entered
into a mysql table. When I use a statement like

INSERT INTO mytable(stuff) values(', , 3');

I get a row that looks like this: "ä, ü ö, ß3"

I have the table and the column set to "utf8_general_ci" encoding and I
am using PHP 4. All I am doing is taking the posted values from a form
and using mysql_real_escape_string to construct the statement listed
above. Is there some other type of encoding that I need to do before
submiting the mysql statement?

BTW, If I do that exact statement on the command line of mysql, it
works, so it is something happening between PHP and mysql.

Thanks!

Jun 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Jake wrote:
I am trying to allow accented characters (, , ) to be entered
into a mysql table. When I use a statement like

INSERT INTO mytable(stuff) values(', , 3');

I get a row that looks like this: "ä, ü ö, ß3"

I have the table and the column set to "utf8_general_ci" encoding and I
am using PHP 4. All I am doing is taking the posted values from a form
and using mysql_real_escape_string to construct the statement listed
above. Is there some other type of encoding that I need to do before
submiting the mysql statement?

BTW, If I do that exact statement on the command line of mysql, it
works, so it is something happening between PHP and mysql.

Thanks!


Yup ! Something sure is happening between PHP and MySql, namely your
connection.
Apart from the fact that your form might not be utf-8 encoded, your
connection might also use a default value, which is often latin1.

I ran into a similar issue the other day myself and wrote a little
article about it:
http://www.adviesenzo.nl/examples/ph...l_charset_fix/

I hope you'll find it helpful and if the suggested fix doesn't solve
your problem, you will probably find the solution in the articles which
I link to at the bottom of my article.

Good luck !
Juliette
Jun 20 '06 #2

P: n/a
On 2006-06-20 20:55:10 +0200, "Jake" <of****@gmail.com> said:
I am trying to allow accented characters (, , ) to be entered
into a mysql table. When I use a statement like

INSERT INTO mytable(stuff) values(', , 3');

I get a row that looks like this: "ä, ü ö, ß3"

I have the table and the column set to "utf8_general_ci" encoding and I
am using PHP 4. All I am doing is taking the posted values from a form
and using mysql_real_escape_string to construct the statement listed
above. Is there some other type of encoding that I need to do before
submiting the mysql statement?

BTW, If I do that exact statement on the command line of mysql, it
works, so it is something happening between PHP and mysql.
Thanks!


Did you try to utf8_encode() your variables? This is a PHP function
from the XML extension.

Jun 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.