Reputation: 2133
The body of an email can be encoded according to encoding specified in a header. This cannot be done for the Subject, which must use a different format. How can this be done in Objective C. A working example of what I'm trying to do is shown at this website.
The output of the method should return what is being returned on this website on the second line: "Encoded Result:".
This is described in RFC 2047. I'll wade through this, if necessary, but surely this has already been done.
Upvotes: 0
Views: 122
Reputation: 2133
NSData *dataForSubject = [message.subject dataUsingEncoding:NSUTF8StringEncoding];
NSString *base64Subject = [dataForSubject base64EncodedStringWithOptions:0];
NSString *stringToPass = [NSString stringWithFormat:@"=?utf-8?b?%@?=",base64Subject];
Upvotes: 1