Friendly Code
Friendly Code

Reputation: 1655

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!

Upvotes: 0

Views: 383

Answers (1)

user783322
user783322

Reputation: 481

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);

Upvotes: 1

Related Questions