View Single Post
Old 03-11-2011, 01:31 PM   #5
Jaycyn
Senior Member
 
Join Date: Mar 2009
Location: Florida
Posts: 313
Default

Just to throw in my .02

This could also be and issue with Indianness - Big Indian vs Little Endian byte order or the encoding not specified, or even UTF-16. Conceptually, the code could be something like.

[[[NSString alloc] initWithData:textStream encoding:NSMacOSRomanStringEncoding] autorelease];

unsigned char *bytes=(unsigned char *)[initWithData:textStream bytes];
unsigned char length=*bytes++;

NSString *string=[[NSString alloc] initWithBytes:bytes length: (unsigned int)length encoding: NSUTF8StringEncoding];

Last edited by Jaycyn; 03-11-2011 at 01:34 PM.
Jaycyn is offline   Reply With Quote