title: Replace occurrences of space in URL
body: <p>I have a URL in an iPhone application to work with. But the problem is that it has some spaces in the URL. I want to replace the spaces with '%20'. I know that there are the <code>stringByReplacingOccurencesOfString</code> and <code>stringByAddingPercentEscapesUsingEncoding</code> methods. I also have used them. But they are not working for me. The spaces are replaced by some unusual values.</p>
  
  <p>I'm applying those methods on an instance of <code>NSString</code>.</p>