title: NSStream, UTF8String & NSString... Messy Conversion
body: <p>I am constructing a data packet to be sent over NSStream to a server. I am trying to seperate two pieces of data with the a '§' (ascii code 167). This is the way the server is built, so I need to try to stay within those bounds...</p>
  
  <pre><code>unichar asciiChar = 167;  //yields @"§"
  [self setSepString:[NSString stringWithCharacters:&amp;asciiChar length:1]]; 
  
  sendData=[NSString stringWithFormat:@"USER User%@Pass", sepString];
  
  NSLog(sendData);
  
  const uint8_t *rawString=(const uint8_t *)[sendData UTF8String];
  
  [oStream write:rawString maxLength:[sendData length]];  
  </code></pre>
  
  <hr>
  
  <p><strong>So the final outcome should look like this.. and it does when sendData is first constructed:</strong> </p>
  
  <pre><code>USER User§Pass 
  </code></pre>
  
  <hr>
  
  <p><strong>however, when it is received on the server side, it looks like this:</strong></p>
  
  <pre><code>//not a direct copy and paste. The 'mystery character' may not be exact
  USER UserÀ§Pas
  </code></pre>
  
  <hr>
  
  <p><strong>...the seperator string has become two in length, and the last letter is getting cropped from the command. I believe this to be cause by the UTF8 conversion.</strong></p>
  
  <p>Can anyone shed some light on this for me?</p>
  
  <p>Any help would be greatly appreciated!</p>