On Jan 21, 2010, at 8:39 AM, Daniel Meachum wrote: > [[NSString alloc] initWithData:imageData > encoding:NSUTF8StringEncoding]];
That's not going to work. Not all series of bytes are valid UTF-8, and in non-textual data like an image you're practically guaranteed to run into illegal UTF-8 sequences pretty quickly. The result will be a nil NSString. If you want a string encoding that supports arbitrary byte values, try NSWindowsCP1252StringEncoding, which is the default encoding used on Windows. (It's a superset of ISO-8859 that includes encodings for 80-9F.) You also haven't done any URL-encoding of the resulting string. Call stringByAddingPercentEscapesUsingEncoding: on the resulting string, but use NSWindowsCP1252StringEncoding as the encoding parameter (or whatever other 8-bit encoding you used.) —Jens PS: Off-topic, I can't believe the Tumblr engineers invented a protocol that's going to almost triple the size of the image data. It's not REST, or even the normal way that HTTP forms upload file attachments. Sigh. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com