I have a .tsv file using Danish letters like Æ Ø Å.
The file is uploaded in php with file_get_contents();
and then processed and made to an mysqli query.
I tried putting <?php header('Content-Type: text/html; charset=utf-8'); ?>
at the very top of the code.
also using the meta tag <meta charset="UTF-8">
and in my SQL I have the rows created like:
text COLLATE utf8_danish_ci NOT NULL
and:
PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_danish_ci AUTO_INCREMENT
and:
$conn->set_charset("utf8");
.... But still no luck.
If I open my .tsv file in excel, then it shows the Æ Ø Å correctly. But when open with "TextEdit" on mac. the "Æ Ø Å" shows like "¯ ¯ ¯"
UPDATE - SOLUTION as the accepted answer refers to I should be using CP1252
:
mb_convert_encoding($fileEndEnd, 'HTML-ENTITIES', "CP1252");