string encoding in NSMutableData
string encoding in NSMutableData
- Subject: string encoding in NSMutableData
- From: Jaime Magiera <email@hidden>
- Date: Wed, 8 Aug 2007 11:15:13 -0400
Hello,
I'm a little dense on string encoding and can't figure out how to
successfully encode a Unicode string as hex into an NSMutableData.
The data is meant to contain "a9415254" for the string
"@ART" (QuickTime Metadata programming)
I create the string in one part of the code...
NSString *artistString = [NSString stringWithFormat:@"ÊRT", 0x00A9];
put it into a dictionary...
NSMutableDictionary *testDict = [NSMutableDictionary dictionary];
[testDict setObject:@"jaime" forKey:artistString];
//Pass the dict to another method for inclusion into the
NSMutableData...
NSMutableData *output;
while(key = [enumerator nextObject])
{
value = [metadataDict objectForKey:key];
NSLog(@"the key %@", key);
output = [NSMutableData dataWithBytes:[key cStringUsingEncoding:
NSUnicodeStringEncoding] length:4];
}
Instead of what I expect, the result is...
a9006100
Which appears to be the string, but with lots of padding :)
This is probably just my ignorance, so any help is appreciated.
Jaime
Jaime Magiera
Sensory Research
http://www.sensoryresearch.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden