| Bug #33475 | Incorrect string value when inserting unicode codepoint \xC2\x92 | ||
|---|---|---|---|
| Submitted: | 21 Dec 2007 23:33 | Modified: | 21 Jan 2008 11:26 | 
| Reporter: | Andreas Götz | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Charsets | Severity: | S2 (Serious) | 
| Version: | 5.0.54 | OS: | Windows | 
| Assigned to: | CPU Architecture: | Any | |
   [21 Dec 2007 23:33]
   Andreas Götz        
  
 
   [21 Dec 2007 23:39]
   Andreas Götz        
  Might this be related to bug 30803 which encounters another problem with the same character?
   [21 Dec 2007 23:44]
   Andreas Götz        
  Character description can be found here: http://www.fileformat.info/info/unicode/char/0092/index.htm This appears to be a perfectly valid utf-8 character. Suspecting a mixup of the unicode character with the mysql ' string delimiter?
   [3 Jan 2008 17:20]
   Susanne Ebrecht        
  Please can you add a smaller test here.
   [3 Jan 2008 19:21]
   Andreas Götz        
  Simple test case:
<?php
require_once('config.inc.php');
$str	= html_entity_decode('’', ENT_NOQUOTES, 'UTF-8');
echo $str;
$db_link = mysql_connect($config['db_server'], $config['db_user'], $config['db_password']);
mysql_select_db($config['db_database'], $db_link);
mysql_query("SET NAMES 'utf8'", $db_link);
mysql_query("INSERT INTO videodata SET title='".$str."'", $db_link);
echo mysql_error($db_link);
?>
I guess I cannot simply type the query in- the exact character matters...
 
   [7 Jan 2008 12:27]
   Andreas Götz        
  Test case in pure SQL (if bug tracking does not screw the character set): set names utf8; select '';
   [10 Jan 2008 10:46]
   Andreas Götz        
  Any chance looking into this? This is a real issue for people working with utf-8 data. Please note that the pure-sql test case provided does _not_ work. I've not been able to create a pure-sql test case.
   [21 Jan 2008 11:26]
   Andreas Götz        
  Resolving as invalid. Reason: with db encoding LATIN1 and connection encoding UTF8, the characters in question cannot be inserted as there is no LATIN1 equivalent for the unicode entities, therefore conversion fails.
   [23 Jan 2008 14:18]
   Tonci Grgin        
  Andreas, this is one of the most common mistake users do, so don't feel bad. I am not a PHP guy but I think I saw somewhere that php does not support UTF8 at all thus making this even harder to fathom. As a general rule, in your next reports, attach my.ini/cnf file as that will definitely help in resolution. Glad the problem is solved. Thanks for your interest in MySQL.
   [9 Dec 2011 0:07]
   Arkadiy Kulev        
  This problem solves easily. Don't forget to not only set the database, table and collation to utf8, BUT THE COLUMNS ALSO! That's what cause the problem for me. I created the table in latin, then switch to utf8, but forgot to also change the columns.
