ios - iPhone Address Book data comes with strange chars in hebraw -


im reading iphone address book , getting strange data brake json i'm trying send server' retrieving code this:

    cferrorref * error = null;     abaddressbookref addressbook = abaddressbookcreatewithoptions(null, error);     cfarrayref allpeople = abaddressbookcopyarrayofallpeople(addressbook);     cfindex numberofpeople = abaddressbookgetpersoncount(addressbook);      for(int = 0; < numberofpeople; i++)     {          abrecordref person = cfarraygetvalueatindex( allpeople, ); //        nsstring* firstname = (__bridge_transfer nsstring*)abrecordcopyvalue(person,kabpersonfirstnameproperty);         cfstringref namef = (cfstringref)abrecordcopyvalue(person, kabpersonfirstnameproperty);         nsstring* firstname = (__bridge_transfer nsstring*)namef;         cfstringref namel = (cfstringref)abrecordcopyvalue(person, kabpersonlastnameproperty);         nsstring* lastname = (__bridge_transfer nsstring*)namel; //        nsstring* lastname = (__bridge_transfer nsstring*)abrecordcopyvalue(person,kabpersonlastnameproperty);     //    [lastname utf8string];     //    [firstname utf8string];         //      nsstring* phone = nil;         abmultivalueref phonenumbers = abrecordcopyvalue(person,kabpersonphoneproperty);          if (abmultivaluegetcount(phonenumbers) > 0) {             self.phone = (__bridge_transfer nsstring*)             abmultivaluecopyvalueatindex(phonenumbers, 0);             abmultivalueref emails = abrecordcopyvalue(person, kabpersonemailproperty);             cfstringref email = abmultivaluecopyvalueatindex(emails, 0);             theemail = (__bridge_transfer nsstring*)email;             //                  nslog(@"theemail:%@", theemail);         }         else         {             self.phone = @"";         }         // email associated person         abmultivalueref emailproperty = abrecordcopyvalue(person, kabpersonemailproperty) ;         // convert array         cfarrayref allemails = abmultivaluecopyarrayofallvalues(emailproperty) ;         // add these emails our initial array         [emails addobjectsfromarray: (__bridge nsarray *)allemails] ;          nslog(@"phone:%@",self.phone);          nslog(@"firstname:%@",firstname);          nslog(@"lastname:%@",lastname);          if (firstname == nil) {             firstname = @"";         }         if (lastname == nil) {             lastname = @"";         }         if (theemail == nil) {             theemail = @"";         }         sing.contactsdict = [[nsmutabledictionary alloc]init];          [sing.contactsdict setobject:firstname forkey:@"fname"];         [sing.contactsdict setobject:lastname forkey:@"lname"];         [sing.contactsdict setobject:self.phone forkey:@"phone"];         [sing.contactsdict setobject:theemail forkey:@"emails"]; //        nslog(@"[sing.contactsdict description]--> %@",[sing.contactsdict description]);         [contactslist addobject:sing.contactsdict];     } 

when nslog see of contacts first name this:2013-07-15 19:03:46.964 numbex[2635:907] firstname:קופ\327\241א

2013-07-15 19:03:46.961 numbex[2635:907] lastname:(null) 

2013-07-15 19:03:46.962 numbex[2635:907] phone:+972549454456 2013-07-15 19:03:46.964 numbex[2635:907] firstname:קופ\327\241א tried replace "\" code:

  nsstring *str  = [jsonstringt stringbyreplacingoccurrences:@"\\" withstring:@" "]; 

and this:

nsstring *str  = [jsonstringt stringbyreplacingoccurrencesofstring:@"\\" withstring:@"#" options:0 range:nsmakerange(0, jsonstringt.length)]; 

but nothing working can please

thanks

ok found way solve it: converted hebrew chars hebrew ascii 1255 code page in in way: 'א' converted 'e0' , on chars , the other way around , working, think work around working.


Comments