Base64 encoding and deprecated stringWithCString: length:
Base64 encoding and deprecated stringWithCString: length:
- Subject: Base64 encoding and deprecated stringWithCString: length:
- From: Nala Gnirut <email@hidden>
- Date: Mon, 5 Oct 2009 17:28:08 +0200
Hi all,
I'm trying to use in a new Cocoa project base64 code sample from here:
http://snipurl.com/sc6wd
Part of the code adopts deprecated + (id)stringWithCString:(const char
*)cString length:(NSUInteger)length
so I'm replacing
long base64Length = BIO_get_mem_data(mem, &base64Pointer);
NSString * base64String = [NSString stringWithCString: base64Pointer
length: base64Length];
with
NSString * base64String = [NSString stringWithCString: base64Pointer
encoding: NSUTF8StringEncoding];
Unfortunately, this modification sometimes works and sometimes adds
random garbage characters at the end of the encoded base64 string.
The issue seems related to the C string -> NSString termination and
conversion.
Any hints?
Thanks in advance.
--
nala
_______________________________________________
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