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 7581693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:15:26+00:00 2026-05-30T18:15:26+00:00

I need to display subscripts and superscripts (only arabic numerals) within a UILabel. The

  • 0

I need to display subscripts and superscripts (only arabic numerals) within a UILabel. The data is taken from an XML file. Here is the snippet of XML file:

<text><![CDATA[Hello World X\u00B2 World Hello]]></text>

Its supposed to display X2 (2 as superscript). When I read the string from the NSXMLParser and display it in the UILabel, it displays it as X\u00B2. Any ideas on how to make it work?

  • 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-30T18:15:27+00:00Added an answer on May 30, 2026 at 6:15 pm

    I think you can do something like this, assuming the CDATA contents have been read into an NSString and passed into this function:

    -(NSString *)removeUnicodeEscapes:(NSString *)stringWithUnicodeEscapes {
        unichar codeValue;
        NSMutableString *result = [stringWithUnicodeEscapes mutableCopy];
        NSRange unicodeLocation = [result rangeOfString:@"\\u"];
        while (unicodeLocation.location != NSNotFound) {
    
            // Get the 4-character hex code
            NSRange charCodeRange = NSMakeRange(unicodeLocation.location + 2, 4);
            NSString *charCode = [result substringWithRange:charCodeRange];
            [[NSScanner scannerWithString:charCode] scanHexInt:&codeValue];
    
            // Convert it to an NSString and replace in original string
            NSString *unicodeChar = [NSString stringWithFormat:%C", codeValue];
            NSRange replacementRange = NSMakeRange(unicodeLocation.location, 6);
            [result replaceCharactersInRange:replacementRange withString:unicodeChar];
    
            unicodeLocation = [result rangeOfString:@"\\u"];
        }
    
        return result;
    }
    

    I haven’t had a chance to try this out, but I think the basic approach would work

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

Sidebar

Related Questions

I need to display data from a database in a html table. I am
I need to display a grid on a webpage. The data will come from
I need display data from a web page in a ListView, for example if
I need to display the log entries from a database. Of course the log
I have some hierarchical data that I need display as a table, can I
I need to display these list elements starting from top, I don't want them
I need to display a list of comments within a view. I have created
I need to display only the first two rows in a table , and
I need to display the number of people responding yes to attend events. Here
I need to display some content within an area that will have rounded corners.

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.