• 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: Initializing unichar variable with a human readable letter
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Initializing unichar variable with a human readable letter
      • From: vincent habchi <email@hidden>
References: 
 >Initializing unichar variable with a human readable letter (From: vincent habchi <email@hidden>)

  • Prev by Date: Re: Data downloading performance
  • Next by Date: Re: WebView and Headers
  • Previous by thread: Initializing unichar variable with a human readable letter
  • Next by thread: Re: Initializing unichar variable with a human readable letter
  • Index(es):
    • Date
    • Thread