I am reading through a UTF-8 encoded file using PHP and splatting the contents straight into a database. However , after i encounter a personality for example ” , it places the next †in to the database.

How do i scribe this properly, i am reading through a UTF-8 file and my database column's collation is really a UTF-8. What shall we be held doing wrong? It is possible to nice function i am missing? Any assistance is welcome.

This really is my table:

CREATE TABLE tblProductData (
  intProductDataId int(10) unsigned NOT NULL AUTO_INCREMENT,
  strProductName varchar(50) NOT NULL,
  strProductDesc varchar(255) NOT NULL,
  strProductCode varchar(10) NOT NULL,
  dtmAdded datetime DEFAULT NULL,
  dtmDiscontinued datetime DEFAULT NULL,
  stmTimestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (intProductDataId),
  UNIQUE KEY (strProductCode)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

EDIT:

I am reading through the date such as this:

$hFile = @fopen($FileName, "r") or exit("\nUnable to open file: " . $FileName);
if($hFile)
{
    while(!feof($hFile))
    {
        $Line = fgets($hFile);
        $this->Products[] = new Product($Line);
    }
    fclose($hFile);
}

You need to set your connection encoding with this particular query

SET NAMES 'utf8'

before storing data.

Keep also in your mind that some database gui or web gui (i.e. phpMyAdmin) shows wrong encoding even when your computer data are encoded properly. This happen for instance with SequelPro on Mac with phpMyAdmin in certain conditions.

You need to believe in browser, i.e. show your placed content inside a page that has the

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

header if the data are proven properly. As well as trust mysql command line while using spend:

echo 'SELECT yourdata FROM your table' | mysql -uuser -pyourpwd db_name

use

mysql_query("SET NAMES utf8");

soon after link with DB and make certain that browser encoding is within utf-8, too

 header("Content-Type: text/html; charset: utf-8");