iphone - NSJSONSerialization JSONObjectWithData:options:error: encoding issue -


in code, download json data encoded in utf8, ideal work nsjsonserialization, when parsed object, it's full of encoding problems such as:

"jo\u00e3o e maria - ca\u00e7adores de bruxas"

(it must "joão e maria - caçadores de bruxas"). tried reencode in ascii, unicode , others no success:

nsdata *downloadeddata = [nsurlconnection sendsynchronousrequest:[nsurlrequest requestwithurl:requesturl cachepolicy:cachepolicy timeoutinterval:timeoutinterval] returningresponse:null error:&error]; nsdictionary *serializeddictionary = [nsjsonserialization jsonobjectwithdata:downloadeddata options:nsjsonreadingallowfragments error:&error]; 

edit: when print using this, shows correctly:

nslog(@"test: %@", [[nsstring alloc] initwithdata:downloadeddata encoding:nsutf8stringencoding]); 

those utf8 encoded characters. format correct, put them on uilabel or , they'll appear expect.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -