Re: Converting string to encoding
Re: Converting string to encoding
- Subject: Re: Converting string to encoding
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sat, 14 Jun 2008 17:19:19 +0200
Le 14 juin 08 à 16:43, Dex Morgan a écrit :
Hello,
I need to encode a quoted-printable text and convert it to given
encoding according to the headers of a message.
I've used some code but the result is wrong.
For example =C3=A8 should be 'è' but the result is two symbols (the
sqrt symbol and another).
I've made these steps:
1) Read the data and put it into an NSString with
ISOLatin1StringEncoding
2) Replaced all =HEX chars sequences
3) Converted to an NSData using ISOLatin1StringEncoding
4) Read it from NSString using the defined encoding
This is the code:
NSString *plain = [[[NSString alloc] initWithData: self
encoding:NSISOLatin1StringEncoding] stringFromQuotedPrintableFormat];
NSData *data = [plain dataUsingEncoding: enc allowLossyConversion:
NO];
encoded = [[NSString alloc] initWithData: data encoding:enc];
Should it be
NSData *data = [plain dataUsingEncoding:NSISOLatin1StringEncoding
allowLossyConversion: NO];
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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