[wp-trac] [WordPress Trac] #34096: Failed to set charset
WordPress Trac
noreply at wordpress.org
Mon Nov 9 13:13:17 UTC 2015
#34096: Failed to set charset
-------------------------------+------------------------------
Reporter: kolorafa | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by kolorafa):
http://kolorafa.firehost.pl/wptest.php
{{{#!php
<?php
define("DBHOST","****");
define("DBUSER","****");
define("DBPASS","****");
define("DBNAME","****");
/*EndOfDbConfig*/
echo '<meta charset="UTF-8" />';
function print_data($link){
$stmt = $link->prepare("SELECT * FROM table1");
$stmt->execute();
$stmt->bind_result($id, $name, $text);
while ($x = $stmt->fetch()) {var_dump($x);
printf ("%d: %s - %s<br/>\n", $id,$name, $text);
}
....
}
function title($text){
echo "<br/><br/>".$text."</br>";
}
$mysqli = new mysqli(DBHOST, DBUSER, DBPASS, DBNAME);
title("Right After connect");
print_data($mysqli);
mysqli_set_charset( $mysqli, "utf8mb4" );
title("Right After mysqli_set_charset");
print_data($mysqli);
$mysqli->query("SET NAMES utf8mb4");
title("Right After SET NAMES");
print_data($mysqli);
title("Self Code");
$self = explode("/*EndOfDbConfig*/",file_get_contents(__FILE__),2);
echo "<br/><br/><pre>".htmlspecialchars($self[1])."</pre>";
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34096#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list