NYCPHP Meetup

[nycphp-talk] fgetcsv and German characters

Stephen Musgrave stephen at capellic.com
Tue Aug 14 13:26:12 EDT 2007


> Interesting... \x9f and \x8a are not valid Latin-1/8895  
> characters.   My guess is that the CSV's are UTF-8 and your  
> database is Latin-1.  If that is the case, try converting the csv  
> to 8859-1 with utf8_decode().

I've tried to use utf8_decode() as well as using iconv to translate  
between UTF-8 AND ISO-8859-1 with no luck.  I guess that leads me to  
believe that the file is encoded in neither of the standards?

Is there any way to tell what the encoding is from within Excel?  (I  
didn't see anything in Excel and Google didn't have anything to  
offer.)  I have the original Excel file.

> It is a bit of a hack, but it should work if the only languages you  
> support are german/spanish/french/english.  If you want your code  
> to work with all languages, you need to change the db encoding to  
> utf8, and make sure all input and output is UTF8.

I am not even at the DB layer yet.




More information about the talk mailing list