How can I encode French characters in objective-c? -


i using google translate in french , letters of result come me symbols. after research, learned because of encoding need because not find enough information.

here code:

   - (void)performtranslation:(nsstring *) inputstr {   nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults];   nsstring *outlang = [defaults objectforkey:@"outlanguage"];   nsstring *inlang=@"tr";  nsstring *textescaped = [inputstr stringbyaddingpercentescapesusingencoding:nsutf8stringencoding];       nslog(@"textescaped=%@",textescaped);   nsstring *url = [nsstring   stringwithformat:@"https://www.googleapis.com/language/translate/v2?     key=aizasyax5dsikm1j-qkc0qkzpynwhgfjypoc84g&q=%@&source=%@&target=%@",textescaped, inlang, outlang];   nslog(@"req : -%@-", url);  nsurlrequest *request = [nsurlrequest requestwithurl:[nsurl urlwithstring:url]];  [[nsurlconnection alloc] initwithrequest:request delegate:self]; 

}

- (void)connection:(nsurlconnection *)connection didreceiveresponse:(nsurlresponse *)response {      nslog(@"didreceiveresponse");        }     - (void)connection:(nsurlconnection *)connection didreceivedata:(nsdata *)data {    nslog(@"didreceivedata=%@",data);    nsstring *result = [[[nsstring alloc] initwithdata:data                                         encoding:nsutf8stringencoding] autorelease];   nslog(@"output : %@", result); 

}

i receive transfert d'argent expect transfert d'argent. d' letter needs different kind of encoding guess.

' html or xml entity. data receiving has been xml encoded. need parse response using proper xml parser if case. i'm guessing manually parsing out data want.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -