I am trying to parse a csv file in PHP. My problem is the following: If there is a field stating with "é" or "í", the parser eats all those characters from the start of a field.
The problem is only present on my host, it's not present when using XAAMP locally (newer PHP version). The PHP version on my host with the bug is: 5.2.6-1+lenny9
The code is nothing but one line of fgetcsv.
while (($program = fgetcsv($handle, 0, ',', '"')) !== FALSE) {...}
This code already outputs the "eaten" version, for example when viewed by print_r.
Is there anything I can do? It must be a bug in PHP something, which has been fixed since then. One alternative option I found out was to just escape the sequence, by putting a comma at the end of a field (my csv source, Google Spreadsheets automatically wraps the field in " " if there is a , present inside). Then I can write a function that deletes the last character if it's a comma (any help on this?).
Is is (or was it) a known bug in PHP, and were there any solutions for this? If not, can you help me with the delete-last-character-if-its-a-comma function?