In PHP, I can call base64_encode(\"\\x00\". $username. \"\\x00\". $password)
and the \"\\x00\"
represents a NULL character.
Now, in Objecti
You could also try this (tested and working - taken from: http://www.cocoabuilder.com/archive/cocoa/174917-nul-characters-in-nsstring-cause-unexpected-results.html)
NSString* s1 = [[NSString alloc] initWithBytes:buffer length:sizeof (buffer)
encoding:CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingUTF16LE)]; // @"A[NUL]end" (*)
NSLog(@"s1 = %@", s1);
NSString* s2 = @"CD";
NSLog(@"s2 = %@", s2) ;
NSString* sC = [s1 stringByAppendingString:s2];
NSLog(@"sC = %@", sC);
NSLog(@"length of s1:%i", [s1 length]);
NSLog(@"length of s2:%i", [s2 length]);
NSLog(@"length of sC:%i", [sC length]);
[s1 release];