Hi i have a db which store state and city names and they have special characters they get stored correctly but when i try to retrieve them back it shows junk characters like Ahmad?b?d instead of AhmadÄbÄd i tried many functions like htmlentities, htmlspecialchars,utf8_encode but nothing is working. thanks....
You must do such: $db->query("SET NAMES 'UTF8'"); $db->query("SET CHARACTER SET utf8"); $db->query("SET COLLATION_CONNECTION = 'utf8_general_ci'"); Code (markup):
i did the following: mysql_query("SET NAMES 'utf8'") or die(mysql_error()); mysql_query("SET CHARACTER SET utf8") or die(mysql_error()); mysql_query("SET COLLATION_CONNECTION = 'utf8_general_ci'") or die(mysql_error()); the output now is : AhmadÄÂbÄÂd
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> HTML: Add it somewhere between <head> and </head> tags.
one more question , in phpmailer $data='hello i am "xyz"'; $mail->Body=$data in the mail it comes as hello i am \"xyz\"
Then, you must to use stripslashes: if(get_magic_quotes_gpc()) $body = stripslashes($data); else $body = $data; PHP:
you may have to use htmlspecialchars for some special characters i use the special characters for copyright for instance http://php.net/manual/en/function.htmlspecialchars.php and here is a list of special characters http://www.saisathyasai.com/html-web-design/html-special-characters-entities-list-chart.html