My mother language uses accents and I usually use the utf8_encode to utf8_decode function in php to avoid problems.
Now I’ve a MySql field of type varchar (utf8_bin) and another of type longtext (utf8_bin).
Varchar returns odd characters, while longtext works good.
Is there a difference between the way they’re managed by php?
$a = "Início";
echo utf8_encode($a)."<br>";
echo utf8_decode($a);
Using MySql field of type varchar I get
InÃcio
In�cio
Using MySql field of type text or longtext I get
Início
witch is the correct output I need.
Are you setting the mySQL charset before running your SQL to fetch the text? With regards to the character encoding issues, see here, did you convert the field encoding when there was already content in the fields?
[…]
It sounds like you’re pretty au fait with general encoding issues, though check here if not.