Reputation: 265
I am making a website where one fills out a form and it creates a PDF. The user will be able to put in diacritic and special characters. The way I am sending the characters to the PHP, those characters will come into the PHP as HTML coded characters i.e. à
. I need to change this to whatever it is PHP will read so when I put it through the PDF maker we have it has the diacritic character and not the HTML code for it.
I wrote a test to try this out but I haven't been able to figure it out. If I have to I will end up writing an array for every possible character they can use and translate the incoming string but I am trying to find an easier solution.
Here is the code of my test:
$title = "Test of Title for use With This Project and it should also wrap because it is sò long! Acutally it is even longer than previously expected!";
$ti = htmlspecialchars_decode($title);
I have been attempting to use the htmlspecialchars_decode()
to convert it but it still comes out as ò and not ò. Is there an easy way to do this?
Upvotes: 0
Views: 907
Reputation: 944451
See the documentation which tells you it won't touch most of the characters you care about and to use html_entity_decode instead.
Upvotes: 1
Reputation: 349232
Use the html_entity_decode
function instead of htmlspecialchars_decode
(which only decodes entities such as &
, "
, <
and >
= special HTML chars, not all entities).
Upvotes: 0