Forum Moderators: open

Message Too Old, No Replies

Small problem with insertion using UTF-8

Why does it behave like this?

         

tomda

7:43 am on Nov 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

When I run this query

$sql = "INSERT INTO forum_users (id, username, realname) VALUES (NULL, 'bernard', _utf8'thomas\'de;\'-(à-é(-')";

1/ Using php (on a webpage), it fails to insert special character in the database and I get

thomas\'de;\'-(

2/ In my phpMyAdmin, it works fine and I get

thomas\'de;\'-(à-é(-')

Any idea why?
Spent already my morning trying to find what's wrong, bouhouhouh!

NB. Use of mb_internal_encoding("UTF-8"); and mysql_query("SET NAMES 'utf8'"); AND Apache 1.3.33 - PHP 4.3.10 - MYSQL 4.1.9

tomda

8:19 am on Nov 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry...
Found the solution, it is just that I had temporarily commented my <!-- HTML charset --> for testing and forgot to remove the <!-- OUPS -->

May be the mod could delete this totally useless post

eelixduppy

2:54 pm on Nov 10, 2006 (gmt 0)



>>>May be the mod could delete this totally useless post

It's not useless if someone else makes the same mistake. Maybe, though, instead of commenting it out they never include it at all (which is relatively the same thing, anyway).

My view is, if it can happen to you, it can happen to any one of us. ;)

Glad you got it!