Convert string latin1 to utf8 to php

Possible duplicate:
Convert utf8 characters to iso-88591 and back to PHP

I have this php file that connects to my MySQL BD, the BD call is latin1_swedish_ci

this is my php code:

<?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("ttbfb", $con); $result = mysql_query("SELECT * FROM news"); while($row = mysql_fetch_array($result)) { echo $row['name']; } mysql_close($con); ?> 

how can i convert the string $ row ['name'] to utf8 before i get the echo?

+4
source share

Source: https://habr.com/ru/post/1440346/


All Articles