Mehdi Posted June 29, 2007 Share Posted June 29, 2007 Hi, I work on an ubuntu system with php 5.2.1. The next code doesn't convert my string to entities! Could you guide me please? <html> <head> <title>Text including html</title> </head> <body> <?php echo phpinfo(); $str= <<<TEXT Einstürzende Neubauten and Marya's & Mother and again "test". TEXT; $code=htmlentities($str, ENT_QUOTES); $code1=htmlspecialchars($str); echo $code,"<br>",$code1; ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/57716-htmlentities/ Share on other sites More sharing options...
chocopi Posted June 29, 2007 Share Posted June 29, 2007 well can give the text you are using, what are getting and what you expect to get please ? Link to comment https://forums.phpfreaks.com/topic/57716-htmlentities/#findComment-285738 Share on other sites More sharing options...
Mehdi Posted June 29, 2007 Author Share Posted June 29, 2007 I'm getting this: Einstürzende Neubauten and Marya's & Mother and again "test". Einstürzende Neubauten and Marya's & Mother and again "test". Link to comment https://forums.phpfreaks.com/topic/57716-htmlentities/#findComment-285743 Share on other sites More sharing options...
Mehdi Posted June 29, 2007 Author Share Posted June 29, 2007 At the first line, the characters &, " and ' have to convert to entities, don't they? Link to comment https://forums.phpfreaks.com/topic/57716-htmlentities/#findComment-285747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.