views:

167

answers:

1

Hi, I am having a problem, pound signs and single quotes are being read from a file as � My code is below:

$fh = fopen($_FILES['importFile']['tmp_name'], "r");
$contents = fread($fh, filesize($_FILES['importFile']['tmp_name']));
var_dump($contents);

Does anybody know how to fix this issue. I know its an encoding issue but unsure as to how to fix it. The file is a CSV file. Thanks

A: 

Use mb_convert_encoding() to convert the text from the encoding used in the file to your output encoding.

Ignacio Vazquez-Abrams