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

  • SEARCH
  • Home
  • 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 7186141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:34:11+00:00 2026-05-28T18:34:11+00:00

I have a unicode hex value in an NSString – how do I output

  • 0

I have a unicode hex value in an NSString – how do I output the character; here’s what I have:

NSLog(@"\U0001D000");

NSMutableString *hexString = [[NSMutableString alloc] initWithString:@"0001D000"];
[hexString insertString:@"\\U" atIndex:0];
NSLog(@"%@", hexString);

The first NSLog outputs the character; the second just produces the output “\U0001D000”

I’ve tried lots of combinations and am at a loss – for example, I tried

NSLog(@"\U%@", hexString);

But this gives a complier error, as it is looking for a string of numbers after the \U

  • 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-28T18:34:12+00:00Added an answer on May 28, 2026 at 6:34 pm

    If your character requires a surrogate pair (U+10000 to U+10FFFF), use CFStringGetSurrogatePairForLongCharacter to convert the Unicode code point into a UTF-16 surrogate pair, and then -initWithCharacters:length: to convert it into an NSString. For example:

    UniChar c[2];
    CFStringGetSurrogatePairForLongCharacter(0x1D000, c);
    NSString *s = [[NSString alloc] initWithCharacters:c length:2];
    

    For other characters (CFStringGetSurrogatePairForLongCharacter returns FALSE), you can skip the conversion and go straight to -initWithCharacters:length:.

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

Sidebar

Related Questions

I have a decimal value of a utf-32 character: $a=21644; How can I convert
I have Unicode strings stored in a database. Some of the character encodings are
I have a unicode string in Python and basically need to go through, character
I have a list of String representations of unicode hex values such as 0x20000
I have a hex-string made from a unicode string with that function: def toHex(s):
I have a string of Hex values... String hexString = 8A65; I need to
Given a Unicode decimal or hex number for a character that's wanting to be
I have some unicode text that I want to clean up using regular expressions.
I have a Unicode file (UTF-16 FFFE little-endian BOM) which contains rows of tab-separated
I have some unicode codepoints (\u5315\u4e03\u58ec\u4e8c\u4e0a\u53b6\u4e4b), which I have to convert into actual characters

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.