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: John Stiles <email@hidden>
- Date: Fri, 8 Jul 2005 18:11:43 -0700
You're probably going to run into some other issues too; long and
short dashes, non-breaking spaces, etc. You might need to make a
substitution table.
On Jul 6, 2005, at 6:17 PM, Steve Palmer wrote:
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:
40blizzard.com
This email sent to email@hidden
_______________________________________________
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