Hi All, If i enter special char like œ, …, ’ ...turning into ? mark in the textarea as well as in the DB. I used $str = str_replace("œ","œ",$str); ...but its not at detecting œ special char....it just turns into ? mark . what action i've to take before entering these special into DB and displaying in the textarea. Thanks, Shiva
Thats because the html page is not using an UTF8 charset but rather Western/Latin1 or some other 7-bit character set which simply does not have the space for the special characters. So two things you gota make sure you do. Set the character set of the HTML to UTF8 Set the collation of the fields in the database to utf8 From there normal queries should store the characters correctly.
You'll probably also want to execute these queries before doing any other: SET CHARACTER SET utf8 SET NAMES "utf8" Or if using mysqli : mysqli_set_charset('utf8');
Hi kblessinggr, thanks for ur reply ... My html page is in utf-8 and also DB column is utf8 ... if i go directly to DB and enter these special char they shown good in DB but not in my textarea (shown testing oe, Œ , ... instead of œ, Œ , … i dont know what is happening ..
how did Gray-fox suggestion resulted shiva about the html entities. I am interested in this topic since I had to convert all the databases, tables and field areas in the DB to utf8 as well the connection in the php script with the mysql_set_charset function so it can insert and fetch and take the information out of the DB and into the DB as well..
Thanks Gray-fox for suggestion, I did $d->setDescription(stripslashes(utf8_decode(addslashes(htmlentities($description[$i], ENT_QUOTES, 'UTF-8', false))))); it shows everthing properly ... but each time while displaying i need to do {$desc|htmlspecialchars_decode} .... and the data in DB is fully encoded ....I feel its not the solution ... I just have problem with these special char