• 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
Re: Converting certain characters from Unicode to ASCII
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting certain characters from Unicode to ASCII


  • Subject: Re: Converting certain characters from Unicode to ASCII
  • From: Steve Palmer <email@hidden>
  • Date: Wed, 6 Jul 2005 18:17:06 -0700

So search and replacing the smart quotes is the way to go then.

Thanks!
- Steve



On Jul 6, 2005, at 6:45am, Clark Cox wrote:

On 7/6/05, Steve Palmer <email@hidden> wrote:

Hopefully a quick question. What is the recommended way to convert
the Unicode character 0x2019 which is an apostrophe to the ASCII
equivalent which is 0x0027? The string has to be down-converted for 7-
bit ASCII transmission and loss of some unconvertable characters is
acceptable but the apostrophe is one that I'd expect should be
convertable. I've tried:


     NSData * textData = [[textView string] dataUsingEncoding:
NSASCIIStringEncoding allowLossyConversion:YES];

with a variety of different encoding types but none of them get me
the right ASCII character. At the very least I can do a search and
replace but I'd like to make sure that I've not missed anything obvious.



The only thing that you've missed is that U+2019 is *not* equivalent to U+27. :) That is, Unicode does not define any decomposition (compatibility or otherwise) from U+2019 to U+0027.

--
Clark S. Cox III
email@hidden
http://clarkcox3.livejournal.com/
http://homepage.mac.com/clarkcox3/


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Converting certain characters from Unicode to ASCII
      • From: John Stiles <email@hidden>
References: 
 >Converting certain characters from Unicode to ASCII (From: Steve Palmer <email@hidden>)
 >Re: Converting certain characters from Unicode to ASCII (From: Clark Cox <email@hidden>)

  • Prev by Date: Re: Problems subclassing NSTableView and NSOutlineView
  • Next by Date: NSToolbar & autosave...
  • Previous by thread: Re: Converting certain characters from Unicode to ASCII
  • Next by thread: Re: Converting certain characters from Unicode to ASCII
  • Index(es):
    • Date
    • Thread