[nycphp-talk] fgetcsv and German characters

Rob Marscher rmarscher at
Tue Aug 14 16:59:40 EDT 2007

On Aug 14, 2007, at 10:01 AM, Stephen Musgrave wrote:
> Oh, how I love character encoding problems!  ;-)
Indeed... there's so many levels where they can get messed up -- the  
way the text was originally encoded, anything that php might do to  
it, the database column character encoding, the database client  
connection encoding, anything php might do to it again, the way  
apache serves it, the encoding specified in the html, and finally the  
browser character encoding setting.

> The problem is that German characters such as ü and ä are being  
> translated to Ÿ and Š respectively when I echo the values to the  
> browser and when inserted into the DB.  I wrote the values to the  
> error log and they come out to \x9f and \x8a respectively.
Maybe you should publicly post a stripped down file that demonstrates  
the problem so that we can pull it down and take a look.

If you create your own csv with those characters (vs. the ones your  
user(s) have uploaded), can you reproduce the problem? [tip... on  
osx, press option-u and then u to create ü and option-u and then a to  
create ä]

Do you have the mbstring extension?  If so, what does running the  
text through mb_detect_encoding < 
function.mb-detect-encoding.php> give you?

When can we all agree that the extra disk space needed for every app  
to use utf8 is worth it?  :)

More information about the talk mailing list