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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:26:27+00:00 2026-05-23T12:26:27+00:00

I work with server. I send request to the server and it answers me

  • 0

I work with server. I send request to the server and it answers me in UTF-8 encoding, but when I try to decode byte array to the string, sometimes I get nil value. How can I decode this bytes array without any errors?

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
{
    [receivedData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSString * result_string=[[[NSString alloc] initWithData:receivedData encoding:NSNonLossyASCIIStringEncoding] autorelease];
    NSLog(result_string);
    //...
}

when I convert using NSUTF8StringEncoding I get something like this:

xt”:””,”newstype”:[{“id”:”1″,”name”:”\u043f\u0440\u043e\u0438\u0441\u0448\u0435\u0441\u0442\u0432\u0438\u0435″,”ic

when I convert using NSNonLossyASCIIStringEncoding I get something like this:

xt”:””,”newstype”:[{“id”:”1″,”name”:”происшествие”,”ic

but sometimes, converting using NSNonLossyASCIIStringEncoding, I get errors. I don’t know why

  • 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-23T12:26:27+00:00Added an answer on May 23, 2026 at 12:26 pm

    I don’t know why this error happened. I fixed it like this:

    -(id)init{
        self=[super init];
        if(self){
            NSArray *codes=[NSArray arrayWithObjects:@"\\u0410",@"\\u0411",@"\\u0412",@"\\u0413",@"\\u0414",@"\\u0415",@"\\u0416",@"\\u0417",@"\\u0418",@"\\u0419",@"\\u041a",@"\\u041b",@"\\u041c",@"\\u041d",@"\\u041e",@"\\u041f",
                            @"\\u0420",@"\\u0421",@"\\u0422",@"\\u0423",@"\\u0424",@"\\u0425",@"\\u0426",@"\\u0427",@"\\u0428",@"\\u0429",@"\\u042a",@"\\u042b",@"\\u042c",@"\\u042d",@"\\u042e",@"\\u042f",
                            @"\\u0430",@"\\u0431",@"\\u0432",@"\\u0433",@"\\u0434",@"\\u0435",@"\\u0436",@"\\u0437",@"\\u0438",@"\\u0439",@"\\u043a",@"\\u043b",@"\\u043c",@"\\u043d",@"\\u043e",@"\\u043f",
                            @"\\u0440",@"\\u0441",@"\\u0442",@"\\u0443",@"\\u0444",@"\\u0445",@"\\u0446",@"\\u0447",@"\\u0448",@"\\u0449",@"\\u044a",@"\\u044b",@"\\u044c",@"\\u044d",@"\\u044e",@"\\u044f",
                            @"\\u0401",@"\\u0451",@"\\u00a0",nil];
            NSArray *res=[NSArray arrayWithObjects:@"А",@"Б",@"В",@"Г",@"Д",@"Е",@"Ж",@"З",@"И",@"Й",@"К",@"Л",@"М",@"Н",@"О",@"П",
                                                   @"Р",@"С",@"Т",@"У",@"Ф",@"Х",@"Ц",@"Ч",@"Ш",@"Щ",@"Ъ",@"Ы",@"Ь",@"Э",@"Ю",@"Я",
                                                   @"а",@"б",@"в",@"г",@"д",@"е",@"ж",@"з",@"и",@"й",@"к",@"л",@"м",@"н",@"о",@"п",
                                                   @"р",@"с",@"т",@"у",@"ф",@"х",@"ц",@"ч",@"ш",@"щ",@"ъ",@"ы",@"ь",@"э",@"ю",@"я",
                                                   @"Ё",@"ё",@" ",nil];
            dic=[[NSMutableDictionary alloc] initWithObjects:res forKeys:codes];
        }
        return self;
    }
    
    -(NSString*)convertToString:(NSString*)str{
        if(str==nil)
            return nil;
        NSString *new_str=str;
        for (NSString *s in [dic allKeys]) {
            new_str=[new_str stringByReplacingOccurrencesOfString:s withString:[dic objectForKey:s]];
        }
        return new_str;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble getting the following to work in SQL Server 2k, but it
I'm trying to request data which is located on another domain/server, but I'm getting
I'm tryng to send an request to Cielo's webservice, but if i send with
Can someone explain how the ASP.NET Web Development Server work? I don't have IIS
I'm trying for a week to make my XSP server work with simple static
I'm developing web app that user can save his/her work to server. The data
i am pretty newbie in terms of flex/RIA frameworks. mostly done work on server
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job
Hi why doesn't this work in SQL Server 2005? select HALID, count(HALID) as CH
I am having problems getting the 'ByAccount' aggregation to work in SQL Server Analysis

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.