chris burgess:
> I'm trying to build nice SEO paths from some objects which have
> accented characters in their names.
> 
> Aim is to do a simple replacement to produce a simple ascii version of
> them, but for some reason the characterset doesn't seem to match -
> both when pulled in from a CSV file and when pulled from the DB.
> 
> When this code is run, only the ë contained in $sample is replaced,
> but not the ë's which are contained in the file example.csv. Yet the
> output shows the same ë character displayed on the console for the
> lines imported from CSV.

Csv file is in utf-8 encoding and ë has different code then you use in 
your php code (iso-8859-1).


> 
> What is the correct way to handle input like the CSV supplied, and be
> able to replace the umlauted e's in it?

You should match encodings at first, take a look at mbstring or iconv.

> 
> Linking to example because the mailing list would probably affect any
> charsets and confuse things ...
> 
> http://glob.bushi.net.nz/tmp/deaccent.phps < source to example
> http://bushi.net.nz/tmp/example.csv
> http://bushi.net.nz/tmp/deaccent.php < output
> http://glob.bushi.net.nz/tmp/deaccent.tgz < tarball with source and CSV
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to