quinta-feira, 3 de março de 2016

PHP + MySQL blob fields and UTF-8

I had problems with graphic accentuation using a blob field in MySQL. When I was a select, the accentuation was not recognized by PHP, but in the others fields, like VARCHAR, CHAR or TEXT were recognized.

The solution was use the PHP function utf8_encode.

 $query = mysql_query("SELECT blob_field FROM table");  
 $arr = mysql_fetch_array($query);  
 echo $arr['field'];  
 >> m�e  
 echo utf8_encode($arr['blob_field']);  
 >> mãe  


Nenhum comentário:

Postar um comentário