Reputation: 423
I'm using htmlspecialchars
to display Greek letters correctly in my html. For that reason I have:
$array = array('sampleGreekString' => 'Ενδιαφερόμαστε για το φορτίο σας')
When I call the function like this:
htmlspecialchars('Ενδιαφερόμαστε για το φορτίο σας')
it works fine and all letters are shown correctly. But when I call it this way:
htmlspecialchars($array['sampleGreekString']);
on the screen are shown only question marks (?). How can I fix this?
Upvotes: 2
Views: 321
Reputation: 1952
suppose u have array like this:
$array = array('sampleGreekString' => 'Ενδιαφερόμαστε για το φορτίο σας');
then try the code this way:
function filter(&$value) {
$value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
array_walk_recursive($array, "filter");
The above code applies htmlspecialchars to all the array elements.
Upvotes: 1