user550
user550

Reputation: 338

HTML double left quote, htmlentities

Hi I am having trouble with a certain character in PHP. the character is “ which should return

“

but when I do

echo htmlentities('“');

I get

�

What Am I doing wrong??

Upvotes: 2

Views: 161

Answers (2)

David Kim
David Kim

Reputation: 866

Try using online interpreter like this one codeonline.

It returned the quote (") without an issue in my case. For further documentation, check documentation:

http://php.net/manual/en/function.htmlentities.php

(FYI, more sandbox tools can be found in this thread).

Upvotes: 0

Musa
Musa

Reputation: 97672

It looks like your file is in utf-8 and version of php is less than 5.4 so tell htmlentities this.

echo htmlentities('“', ENT_COMPAT | ENT_HTML401, "UTF-8");

Upvotes: 5

Related Questions