Re: Initializing unichar variable with a human readable letter
Re: Initializing unichar variable with a human readable letter
- Subject: Re: Initializing unichar variable with a human readable letter
- From: Ken Thomases <email@hidden>
- Date: Sat, 17 Jul 2010 16:29:13 -0500
On Jul 17, 2010, at 3:58 PM, vincent habchi wrote:
> I have a very simple problem: I'd like to affect to a unichar variable the value of the glyph é (or any non-ascii character).
>
> If I (naively) write: "unichar foo = 'é';", I get a warning from the compiler about multibyte const and it does not work.
Doing this will probably work:
unichar foo = L'é';
The 'L' prefix means a "long" character AKA a wide character constant.
However, which compiler version are you using? What encoding is the source file in? In Xcode, you can do Get Info on the file to set that.
With modern compilers, it should be possible to do (roughly) what you want if the source file is UTF-8 encoded. However, note that "é" is often represented as "e" followed by U+0301 COMBINING ACUTE ACCENT. That is, the single grapheme is two characters. So, no matter the encoding, that won't fit into a unichar. There is a single precomposed "é" character, U+00E9 LATIN SMALL LETTER E WITH ACUTE, but it's not always clear which you get with any given input mechanism.
Cheers,
Ken
_______________________________________________
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