URL's with integrated article title

i would like to find a script that generates a string out of a title,
so that i can use this in an URL and use it to get that article out of my MYSL db.

spaces are easy to replace by an underscore.
but what with special characters?

good example:
http://www.digg.com/apple/iPhone_Buyers_Have_No_Regrets_Overwhelmingly_Happy