title: Symbol substitution in URLs: What to do when replacement already exists in input?
body: <p><em>If you can come up with a better title, feel free to edit.</em></p>
  
  <p>I am trying to create a simple JavaScript system that shows a certain comic based on the #fragment identifier (a.k.a. hash) of the URL.</p>
  
  <p>When using spaces or similar special characters in this hash they will get converted to %20 or a similar sequence, through means of URL encoding.</p>
  
  <p>This does not look nice. Thus, when you want to refer to a certain comic,blogpost,etc by its title in the URL, I believe it is common to replace all spaces and other URL-unsafe characters by a different URL-safe symbol. In fact, StackOverflow does this as well.</p>
  
  <p>However, what do I do when the symbol I want to replace it with also exists in the input string?</p>
  
  <p>For instance, when I substitute all spaces ( ) with hyphens (-), what do I do with already existing hyphens?</p>