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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:47:47+00:00 2026-05-31T06:47:47+00:00

I’ve tried to get some data which contains utf-8 characters from iOS, ended up

  • 0

I’ve tried to get some data which contains utf-8 characters from iOS, ended up failing : (

  1. JSON data come from Rails app.

    render :json => @users

    snippet shows below:
    {"likes_num":554,"name":"\u62c9\u7f8e\u4eb2\u5386\u8bb0\u00a0","remote_id":63573783,"remote_identifier":"douban"}

  2. Used both NSJSONSerialization and SBJson with failures. And it seems utf-8 string are modified as name = "\U62c9\U7f8e\U4eb2\U5386\U8bb0\U00a0";(Using NSLog(@"%@", json)).

  3. NSLog(@"%@", [json objectForKey:@"name"]) just return nothing, leave no log.
  4. Save the name as NSString *name, and NSLog remains the same, but print description of name when debug, the utf-8 sentence appears perfectly.
  5. Tried [name description], got nothing either.

Please give me some hints to figure out what really happens to my utf-8 sentence.
Thanks in advanced.

UPDATE: Value for other keys works fine, i.e [json objectForKey:@"remote_identifier"] gives douban, only @"name" down for no reason.

Dave

  • 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-31T06:47:48+00:00Added an answer on May 31, 2026 at 6:47 am

    With the help from a colleague of mine, i got over this finally. Here is how:

    Actually, there are something i haven’t mentioned in the question that the value of name can sometimes be null or nil. And with this type of value, the type of this field is set to something related to KFNull, and every access of the data risk in sending a isEqualToString: to NSNull which doesn’t response to that method.

    And i still don’t understand why NSLog failed to print out the non-null data. But i’ve got a solution to the problem.

     NSString *name = [json objectForKey:@"name"];
     if ((CFNull)name == kCFNull)
       name = nil;
     myLabel.text = name;
    

    Surprisingly it have no relation with encoding : /

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

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have some data like this: 1 2 3 4 5 9 2 6
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from

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.