I have the following very simple code that retrieves utf8 formatetd data, such as containing umlauts from the mysql database, which may or may not be installed as utf8. If I use any of the commented approaches to ensure utf8 data is returned, the data will NOT be returned as utf8, however, if I do not delete it, the data will be displayed. Why does utf8 force negate data mapping as utf8?
<?php $con = mysqli_connect("localhost", "x", "", "x"); //$con->query("SET NAMES 'utf8'"); //$con-set_charset('utf8'); $recordsQuery = "SELECT ARTICLE_NAME FROM AUCTIONS1"; if ($getRecords = $con->prepare($recordsQuery)) { $getRecords->execute(); $getRecords->bind_result($ARTICLE_NAME); while ($getRecords->fetch()) { echo "<p>$ARTICLE_NAME"; } } else { print_r($con->error); }
php mysql character-encoding
Joshxtothe4 Mar 08 '09 at 21:15 2009-03-08 21:15
source share