Purifier icon indicating copy to clipboard operation
Purifier copied to clipboard

Problem with utf-8 characters

Open tomswinkels opened this issue 10 years ago • 1 comments

The output have some problem with the utf-8 characters.

How can i fix this?

Input: zorg & welzijn Output: zorg & amp; welzijn

Code: \Purifier::clean( \Input::get( 'name' ) );

return [ 'encoding' => 'UTF-8', 'finalize' => true, 'preload' => false, 'settings' => [ 'default' => [ 'HTML.Doctype' => 'HTML 4.01 Transitional', 'HTML.Allowed' => '' ], ], ];

Now i do: htmlspecialchars_decode(\Purifier::clean( \Input::get( 'name' ) ),ENT_NOQUOTES);

tomswinkels avatar Mar 17 '15 10:03 tomswinkels

This issue is invalid. & is not a UTF-8 specific character, it's a special character in HTML and should be escaped. It appears that you want to convert HTML in to simple text; witch is not the purposes of this library. Even if it was you are filing the issue with the wrong package as this is just the glue between Laravel and the actual HTMLPurifier package.

For you solution you should use html_entity_decode() instead of htmlspecialchars_decode() and ENT_QUOTES instead of ENT_NOQUOTES.

AJenbo avatar Jan 27 '16 14:01 AJenbo