title: How to use NULL character with NSString?
body: <p>In PHP, I can call <code>base64_encode("\x00". $username. "\x00". $password)</code> and the <code>"\x00"</code> represents a NULL character.</p>
  
  <p>Now, in Objective-C, I have a function that converts NSData to <a href="http://www.cocoadev.com/BaseSixtyFour" rel="nofollow noreferrer">base64 encoded NSString</a> created by DaveDribin.</p>
  
  <p>How do I create data from a string that has NULL characters?</p>
  
  <p>This doesn't seem to work...</p>
  
  <pre><code>NSData * authCode = [[NSString stringWithFormat:@"%c%@%c%@", '\0', self.username, '\0', self.password] dataUsingEncoding:NSUTF8StringEncoding];
  </code></pre>