title: Convert characters to HTML Entities in Cocoa
body: <p>I am currently trying to put together an URL where I specify some GET parameters. But I want to use japanese or other characters too in this URL.</p>
  
  <p>Is there a way to convert a NSString to a string containing the HTML entities for the 'special' characters in my NSString?</p>
  
  <p>I am currently using the following code, which seems to work, except for 'special characters' like chinese and japanese:</p>
  
  <pre><code>NSString* url = @"/translate_a/t?client=t&amp;sl=auto&amp;tl=";
  url = [url stringByAppendingString:destinationLanguage];
  url = [url stringByAppendingString:@"&amp;text="];
  url = [url stringByAppendingString:text];
  
  NSURL* nsurl = [[NSURL alloc] initWithScheme:@"http" host:@"translate.google.com" path:url]; 
  
  NSError* error;
  NSString* returnValue = [[NSString alloc] initWithContentsOfURL:nsurl encoding:NSUTF8StringEncoding error:&amp;error];
  </code></pre>