Re: Converting certain characters from Unicode to ASCII
Re: Converting certain characters from Unicode to ASCII
- Subject: Re: Converting certain characters from Unicode to ASCII
- From: Clark Cox <email@hidden>
- Date: Wed, 6 Jul 2005 09:45:11 -0400
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