c_shelswell Posted May 20, 2009 Share Posted May 20, 2009 Hi I'm struggling a bit with htmlentities. I've got a text input and a user that wants to add greek symbols such as 'Σ'. After input I add it to the database as htmlentities('Σ'); But what i'm getting in the database is: Σ when it should be Σ any ideas anyone? Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted May 20, 2009 Author Share Posted May 20, 2009 ok - my bad seems I should have done some research. I need to add in html_entity_decode. Though why it doesn't just add it correctly? Or am i missing something? Quote Link to comment Share on other sites More sharing options...
waynewex Posted May 20, 2009 Share Posted May 20, 2009 Look at the charset specified inside your head tages in your html/xhtml. Mine is usually utf-8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> So if I'm using htmlentities - I specify the charset I'm using. htmlentities(STRING, QUOTE STYLE, CHARSET) In practice, it's: $string = htmlentities($string,ENT_QUOTES,"utf-8"); Don't worry about the ENT_QUOTES part... that just means that you've chosen to change all single and double quotes into their respective html entities. Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted May 20, 2009 Author Share Posted May 20, 2009 cheers wayne, Though as soon as I add the encoding in i get: cannot yet handle MBCS in html_entity_decode() The server i'm on is PHP4 which from what i'm reading is a problem? Cheers Quote Link to comment 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.