Re: Entering UniCode
Re: Entering UniCode
- Subject: Re: Entering UniCode
- From: Darrin Cardani <email@hidden>
- Date: Fri, 6 Feb 2004 10:56:10 -0600
At 10:42 AM -0600 2/6/04, Chris Hanson wrote:
On Feb 6, 2004, at 9:30 AM, Darrin Cardani wrote:
How does one enter UniCode characters into a string in Project
Builder given the UniCode value? I know the syntax is something
like "\U0064", but I can't seem to get it quite right, and I can't
find anything in the docs about it. Any help would be appreciated.
I don't believe there is any such syntax.
It gives me a warning that leads me to believe there's a way. It says:
incomplete universal-character-name
twice for a line containing @"\U0064", for example.
Objective-C source files are assumed to be ASCII and any static
NSStrings (@"") are assumed to be in the default encoding. So any
non-ASCII characters need to go through the localization (Unicode
.strings file, NSLocalizedString macro) mechanism.
That would be great, except that the character I'm trying to get into
a string is the Unicode "nextline" character (0x0085, I believe). I
have no idea how to enter one of those into a file in the first
place! And don't .strings files use the ends of lines to separate the
strings in the file?
I believe (but I'm not certain) that you can also cheat and tell
Project Builder or Xcode that your file is in UTF-8 encoding, and
then use +[NSString stringWithUTF8String:] to create an NSString
from a C string in UTF-8 encoding. Of course you'll also have to
make sure your source code control system will handle the file; some
freak out on non-ASCII data.
Yes, you can. And according to the docs, GCC will even let you put in
actual newlines (instead of "\n"), and it will do the right thing. I
don't know if it would work with the nextline character, but even if
it does, it still leaves the question of how to get the character
into the file in the first place.
But it just occurred to me what I need to do. I'm actually trying to
make a character set with just the newline/end of line characters but
not the whitespace characters. I just realized there is an
NSMutableCharacterSet, and I can remove the whitespace characters
from the whitespaceAndNewlineCharacterSet. So I guess that solves my
problem. But I could swear I've seen the "\U" syntax before and
there's a way to make it work. But maybe I'm hallucinating?
Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<
http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.