Why fgetcsv drops some characters with diacritics?

bruce21

New Member
\[quote\] Similar questions:
Some characters in CSV file are not read during PHP fgetcsv() ,
fgetcsv() ignores special characters when they are at the beginning of line\[/quote\]My application has a form where the users can upload a CSV file (its 5 internal users have always uploaded a valid file - comma-delimited, quoted, records end by LF), and the file is then imported into a database using PHP:\[code\]$fhandle = fopen($uploaded_file,'r');while($row = fgetcsv($fhandle, 0, ',', '"', '\\')) { print_r($row); // further code not relevant as the data is already corrupt at this point}\[/code\]For reasons I cannot change, the users are uploading the file encoded in the \[code\]Windows-1250\[/code\] charset. The problem: Win1250 is a single-byte, 8-bit character encoding, and some (not all!) characters over 127 are dropped. Example data:\[code\]"15","
 
Back
Top