Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 570595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:25:06+00:00 2026-05-13T13:25:06+00:00

Xcode complaints about multi-character character contant’s when I try to do the following: static

  • 0

Xcode complaints about “multi-character character contant”‘s when I try to do the following:

static unichar accent characters[] = { 'ā', 'á', 'ă', 'à' };

How do you make an array of characters, when not all of them are ascii? The following works just fine

static unichar accent[] = { 'a', 'b', 'c' }; 

Workaround

The closest work around I have found is to convert the special characters into hex, ie this works:

static unichar accent characters[] = { 0x0100, 0x0101, 0x0102 };
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:25:07+00:00Added an answer on May 13, 2026 at 1:25 pm

    It’s not that Objective-C doesn’t like it, it’s that C doesn’t. The constant 'c' is for char which has 1 byte, not unichar which has 2 bytes. (see the note below for a bit more detail.)

    There’s no perfectly supported way to represent a unichar constant. You can use

    char* s="ü";
    

    in a UTF-8-encoded source file to get the unicode C-string, or

    NSString* s=@"ü";
    

    in a UTF-8 encoded source file to get an NSString. (This was not possible before 10.5. It’s OK for iPhone.)

    NSString itself is conceptually encoding-neutral; but if you want, you can get the unicode character by using -characterAtIndex:.

    Finally two comments:

    • If you just want to remove accents from the string, you can just use the method like this, without writing the table yourself:

      -(NSString*)stringWithoutAccentsFromString:(NSString*)s
      {
          if (!s) return nil;
          NSMutableString *result = [NSMutableString stringWithString:s];
          CFStringFold((CFMutableStringRef)result, kCFCompareDiacriticInsensitive, NULL);
          return result;
      }
      

      See the document of CFStringFold.

    • If you want unicode characters for localization/internationalization, you shouldn’t embed the strings in the source code. Instead you should use Localizable.strings and NSLocalizedString. See here.

    Note:
    For arcane historical reasons, 'a' is an int in C, see the discussions here. In C++, it’s a char. But it doesn’t change the fact that writing more than one byte inside '...' is implementation-defined and not recommended. For example, see ISO C Standard 6.4.4.10. However, it was common in classic Mac OS to write the four-letter code enclosed in single quotes, like 'APPL'. But that’s another story…

    Another complication is that accented letters are not always represented by 1 byte; it depends on the encoding. In UTF-8, it’s not. In ISO-8859-1, it is. And unichar should be in UTF-16. Did you save your source code in UTF-16? I think the default of XCode is UTF-8. GCC might do some encoding conversion depending on the setup, too…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.