Say I have this webpage: http://ww.xyz.com/Product.aspx?CategoryId=1
If the name of CategoryId=1 is "Dogs" I would like to convert the URL into something like this: http://ww.xyz.com/Products/Dogs
The problem is if the category name contains foreign (or invalid for a url) characters. If the name of CategoryId=2 is "Göra äldre", what should be the new URL?
Logically it should be: http://ww.xyz.com/Products/Göra äldre
but it will not work.
Firstly because of the space (which I can easily replace by a dash for example) but what about the foreign characters? In Asp.net I could use the URLEncode function which would give something like this: http://ww.xyz.com/Products/G%c3%b6ra+%c3%a4ldre
but I can't really say it's better than the original URL (http://ww.xyz.com/Product.aspx?CategoryId=2
).
Ideally I would like to generate this one but how can I can do this automatically (ie converting foreign characters to 'safe' URL characters): http://ww.xyz.com/Products/Gora-aldre
.