简体   繁体   中英

PHP htmlentities quotes issue

I have the joy of using recoding existing database data that has been entered directly into the SQL database without having htmlentities used. It is also a french website.

I am now trying to output this to the browser and all of the french characters are appearing fine through using htmlentities(), however the unecoded ' and ' are giving me problems.

An example of the text I am trying to display is:

The ‘Maison de Maître’ is very...

And the code to display it

$p_title = htmlentities(stripslashes($pr['title']), ENT_QUOTES);

This does not work - I have also tried using UTF-8 as the charset which stops the title showing at all.

Any help would be much appreciated!

You could try this. It works for this specific problem, but I don't know if it does all that you need.

$p_title = htmlspecialchars(stripslashes($pr['title']), ENT_QUOTES);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM