Jump to content

CSV files and DOS ASCII charset


valvet

Recommended Posts

Hi

 

I'm trying to import the data from here: http://188.40.183.103/temp_dont_delete/LagKarLagPris.txt

 

It's a Microsoft C5 dump of products. Acording to the developer who dumped it, it's charset is DOS ASCII - I've tried all the iconv conversations I can think of, to no avail. I still get weird characters instead of æø and å. If you look at it in your browser, you'll also notice it failing to decode it properly.

 

57-8302-Rosa-98/104;Bomulds undertr›je k/‘, 3

 

Should be

 

57-8302-Rosa-98/104;Bomulds undertrøje k/‘, 3

 

$data = file_get_contents('./LagKarLagPris.txt');
$cols = 73;
$delim = ';';
$data = array_chunk(str_getcsv($data, $delim), $cols);

foreach ($data as $key => $val)
{
  // $val[2][1] is the product title
  foreach (mb_list_encodings() as $chr)
    print mb_convert_encoding($val[2][1], 'UTF-8', $chr) . " : $chr\n";
}

 

Any ideas? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/227719-csv-files-and-dos-ascii-charset/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.