Page 1 of 1

Storing Special Characters in Table

Posted: Mon Feb 09, 2009 7:26 am
by ummarbhutta
Hi all!
I am having provlem storing special characters in to Database table.. I have a table named messages having following structure

MESSAGE_ID bigint(20)
Catagory_ID int(11)
Message text

The table Collation is "utf8_unicode_ci" and also the Message field's collation is "utf8_unicode_ci", but when I store a Message e.g.

but when I store any special character in Message field like “ and ` they are stored like %20xx etc etc.. and being displayed on HTML as %20xx etc.. whcih doesn't seem good.. Please help me out. how to solve this problem.. My Table storage engine is "InnoDB".. Please I need quick help..

Re: Storing Special Characters in Table

Posted: Mon Feb 09, 2009 7:29 am
by VladSun

Re: Storing Special Characters in Table

Posted: Mon Feb 09, 2009 8:00 am
by ummarbhutta
This is about URL Encode.. I am having problem storing it in DB? Will it solve the problem.. I think there is problem in Insert Query.. ?? Should I use some escape sequences?

Re: Storing Special Characters in Table

Posted: Mon Feb 09, 2009 8:03 am
by VladSun
I think your $Message is URL encoded.

Re: Storing Special Characters in Table

Posted: Mon Feb 09, 2009 8:18 am
by ummarbhutta
Ok I will try it.. you are saying that before storing in DB I should URL encode it?

Re: Storing Special Characters in Table

Posted: Mon Feb 09, 2009 8:23 am
by VladSun
ummarbhutta wrote:Ok I will try it.. you are saying that before storing in DB I should URL encode it?
No, just the opposite - you should decode it.

Code: Select all

$Message = mysql_real_escape_string(urldecode($Message));