Re: Parsing .vcf files SOLVED
Re: Parsing .vcf files SOLVED
- Subject: Re: Parsing .vcf files SOLVED
- From: "Clark S. Cox III" <email@hidden>
- Date: Thu, 17 Oct 2002 16:57:16 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday, Oct 17, 2002, at 16:42 US/Eastern, Donald Brown wrote:
NSUnicodeStringEncoding assumes a header to the data that gives the
byte
order (0xFFFE or 0xFEFF). This UTF16 doesn't include the header.
No, it doesn't, try the following code:
#import <Foundation/Foundation.h>
unsigned char testData[] = {0,'T',0,'e',0,'s',0,'t'};
int main()
{
id localPool = [NSAutoreleasePool new];
NSData *data = [NSData dataWithBytes: testData
length: sizeof testData];
NSString *test = [[[NSString alloc] initWithData: data
encoding: NSUnicodeStringEncoding] autorelease];
NSLog(@"%@", test);
[localPool release];
return 0;
}
I get the following output:
[clarkg4:~] clarkcox% cc -framework Foundation temp.m
[clarkg4:~] clarkcox% ./a.out
2002-10-17 16:56:58.380 a.out[3356] Test
- --
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iEYEARECAAYFAj2vJDEACgkQd6STocYT1xW9SQCfZ9T+j8fj3D3RmMEpBa1OwsVn
Zx4Anis3fiMBBvEdnLgusJpKHFtEBg3O
=pkCe
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.