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? Link to comment https://forums.phpfreaks.com/topic/158880-trouble-with-htmlentities/ 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? Link to comment https://forums.phpfreaks.com/topic/158880-trouble-with-htmlentities/#findComment-837964 Share on other sites More sharing options...
waynew 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. Link to comment https://forums.phpfreaks.com/topic/158880-trouble-with-htmlentities/#findComment-837973 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 Link to comment https://forums.phpfreaks.com/topic/158880-trouble-with-htmlentities/#findComment-837977 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.