I have written data crawling engine which does (so far) everything right except it completely stops data inserting process at the point where euro € symbol ocurres in the text. I belive this symbol may not be the only one.
If string that is about to be inserted into database table looked like this:
Quick brown € fox jumped over the laizy dog.
this would end up in database:
My trouble is that I’ve followed several instructions found on this site about precisely this issue
, with no luck.
What I have already done to fix this(php-side):
made sure that:
mysqli_set_charset($dblink, "utf8"); mysqli_real_escape_string($dblink, $string);
iconv('windows-1250','utf8//TRANSLIT', $string ); iconv('windows-1250','utf8', $string );/*crawled web page declared windows-1250 characterset*/
(here I had success finishing data insertion with € symbol preserved, however other latin characters čćšđž was completely degraded)
several others attempts with
attempts to change server response with of
Table and fields was set to utf8_unicode_ci
tried to fix
DEFAULT CHARACTER SET
to utf8 (did that to existing, non-empty database)
No success. Whatever I attempt to, insertion process stops with € symbol.
Does anyone know what should I do?
I’ve tested these on my php/mysql install, and both work. Note, I couldn’t get euro to work on my command line since my character encoding didn’t support it, so I selected it out of a DB first which worked perfectly.
$original = 'Quick brown '.$euro.' fox jumped over the laizy dog.'; $escaped = str_replace($euro,'\'.$euro,$original); echo $escaped; $database->insertSQL('insert into test (text) values (''.$original.'')'); $database->insertSQL('insert into test (text) values (''.$escaped.'')');
Both the original and escaped insert correctly into my DB, and the escaped doesn’t have the backslash since SQL knows how to handle it.
The only thing I can think might be incorrect with your DB, is the encoding. My encoding is latin1_swedish_ci. If you change the encoding on your table, does my code block above help?