At 02:31 PM 3/17/2002 +0100, andy wrote: >Hi there, > >I am wondering if it would be possible to replace all chars which are not >inbetween [a-z] with a valid asccii coresponding to it. I have a db with a >bunch of citynames and I would like to create valid filenames out of those. >The prob is, that I do not know all special chars. For example there was >one: ï which I did not know. So maybe there are a lot others similar like >that. > >The point is, how could I create a valid filename out of those citynames >which contains only the chars from a - z? I tryed erregrplc, but I do have >to know the char for that.
I found this in the user contributed notes for the function strtr(). It looks like what you need: function removeaccents($string) { return strtr($string, "ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ", "SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy"); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php