Mantis - Quercus
Viewing Issue Advanced Details
3203 minor always 12-29-08 12:15 01-03-09 13:43
nam  
ferg  
high  
closed 4.0.0  
fixed  
none    
none 4.0.0  
0003203: SET NAMES 'utf-8', VARCHAR string truncation
(rep by M. Schmidt)

<?php

$db = mysql_connect();
mysql_query("CREATE DATABASE test");
mysql_select_db("test");

mysql_query("DROP TABLE test");
mysql_query("CREATE TABLE test (a VARCHAR(10), b BLOB(10))");
mysql_query("SET NAMES 'utf8'");

mysql_query("INSERT INTO test VALUES ('\xC2\xA2', '\xC2\xA2')");
$result = mysql_query("SELECT * FROM test");

$array = mysql_fetch_assoc($result);
var_dump(bin2hex($array["a"]));
var_dump(bin2hex($array["b"]));

?>

results:
string(2) "a2"
string(4) "c2a2"

expected results:
string(4) "c2a2"
string(4) "c2a2"

Notes
(0003689)
ferg   
01-03-09 13:43   
php/1468