divinequran Posted October 29, 2009 Share Posted October 29, 2009 Hi, I have created a db with utf-8, I post the php values with and add those values into a db. $val = $_POST['dbdat']; when i print values got in the variables, it prints the exact value as "£ ". But after inserting this value in DB, it retrieves the value and displays it as some junk character please help. Quote Link to comment https://forums.phpfreaks.com/topic/179510-utf-8-character/ Share on other sites More sharing options...
JonnoTheDev Posted October 29, 2009 Share Posted October 29, 2009 Where you connect to the db run the following query prior to any other mysql_query("SET NAMES UTF8") Quote Link to comment https://forums.phpfreaks.com/topic/179510-utf-8-character/#findComment-947212 Share on other sites More sharing options...
cags Posted October 29, 2009 Share Posted October 29, 2009 You need to check the character encoding of the page you are using to output it (which is probably correct), you will also need to change the character set of the database connection. Have you tried putting... mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET 'utf8'"); ...after your mysql_connect statement. Hopefully utf8 is the right value for both, just pulled it off the topic of my head so may not be 100%. Edit: d'oh Quote Link to comment https://forums.phpfreaks.com/topic/179510-utf-8-character/#findComment-947215 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.