Hello all,
I am working on a project and have the following dilemma:
I have a CSV file generated by a Microsoft application that has some sort of “Microsoft-isums” what I mean by this, is that I cannot simply run a “Load data infile” to get the contents of this file into MySQL.
I can get php to read this file with the following code:
$filename = myfile.csv';
$handle = fopen($filename, "rb");
$contents = fread($handle, filesize($filename));
fclose($handle);
echo $contents;
This will print the contents of myfile.csv to the screen (without using the ‘b’ argument when defining my $handle variable all I get is a ton of binary text).
What I need to do it output the contents of this file into a plain ascii / text file so I can import it into MySQL, I have tried everything from iconv to ereg_replace with no luck..
Any advice is greatly appreciated, all I really need to do is remove all NON-VISIBLE characters from my string ($contents in the above code).
Thanks!