• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Converting string to encoding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Converting string to encoding


  • Subject: Converting string to encoding
  • From: Dex Morgan <email@hidden>
  • Date: Sat, 14 Jun 2008 16:43:56 +0200

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];


This is an example of the message (it's an UTF-8 + quoted printable string):
http://pastebin.com/m5b3f114e


This is the code I've used to replace escapes sequences (stringFromQuotedPrintableFormat)
http://pastebin.com/m763590f7


Anyone can tell me what I'm wrong. I'm going crazy with this thing :)_______________________________________________

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


  • Follow-Ups:
    • Re: Converting string to encoding
      • From: Jens Alfke <email@hidden>
    • Re: Converting string to encoding
      • From: Ricky Sharp <email@hidden>
    • Re: Converting string to encoding
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: CoreAnimation removeFromSuperlayer flicker
  • Next by Date: checkbox in nstableview
  • Previous by thread: Re: CoreAnimation removeFromSuperlayer flicker
  • Next by thread: Re: Converting string to encoding
  • Index(es):
    • Date
    • Thread