I have some french words in a table and I want to display each of them character by character. However, when using str_split
or any other way of converting the string into array (like $string[$i]
), the accented characters are not showing at all.
On the other hand if I output the string directly, the accented characters are displaying correctly.
Example:
echo "Québec"
outputs Québec
(correct)
str_split("Québec")
outputs Q u b e c
(issue)
The above indicates that it's not an encoding issue. I have also tried htmlentities($string, 0, 'UTF-8')
in order to have HTML-safe characters but now when splitting html entities I get the following:
str_split(htmlentities("Québec", 0, 'UTF-8'))
outputs Q u & e a c u t e ; b e c
(issue)
How can I display each character separately but displaying accented characters correctly?