title: How do you remove invalid characters when creating a friendly url (ie how do you create a slug)?
body: <p>Say I have this webpage:<br>
  <a href="http://ww.xyz.com/Product.aspx?CategoryId=1" rel="noreferrer">http://ww.xyz.com/Product.aspx?CategoryId=1</a></p>
  
  <p>If the name of CategoryId=1 is "Dogs" I would like to convert the URL into something like this:<br>
  <a href="http://ww.xyz.com/Products/Dogs" rel="noreferrer">http://ww.xyz.com/Products/Dogs</a></p>
  
  <p>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? </p>
  
  <p>Logically it should be:<br>
  <a href="http://ww.xyz.com/Products/G%C3%B6ra" rel="noreferrer">http://ww.xyz.com/Products/Göra</a> äldre<br>
  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:<br>
  <a href="http://ww.xyz.com/Products/G%c3%b6ra+%c3%a4ldre" rel="noreferrer">http://ww.xyz.com/Products/G%c3%b6ra+%c3%a4ldre</a><br>
  but I can't really say it's better than the original url (<a href="http://ww.xyz.com/Product.aspx?CategoryId=2" rel="noreferrer">http://ww.xyz.com/Product.aspx?CategoryId=2</a>)</p>
  
  <p>Ideally I would like to generate this one but how can I can do this automatically (ie converting foreign characters to 'safe' url characters):<br>
  <a href="http://ww.xyz.com/Products/Gora-aldre" rel="noreferrer">http://ww.xyz.com/Products/Gora-aldre</a>  </p>