Convert any title to url slug and back from url slug to title

I want to convert any title e.g. of a blog entry to a user friendly url. I used rawurlencode() to do that but it gives me a lot of strange strings like %s.

The algorithm should consider german chars like Ö, Ä, etc. I want to make a url from title and be able to get the title by decoding the url.

I tried some of this code: http://pastebin.com/L1SwESBn that is provided in some other questions but it seems to be one way.

E.g. HÖRZU.de -> hoerzu-de -> HÖRZU.de

Any ideas?

9
задан Jon 24 December 2010 в 09:51
поделиться