해결해야 할 텍스트 서식 문제가 있습니다. 나는일부 텍스트를 올바르게 인코딩하는 방법
아래에있는 NSString에서 원래 문자열을 표시하는 이상한 문자가 :
NSString *descriptionStringPreFormatted = [item objectForKey:@"title"];
포맷 된 문자열 :
NSString *descriptionLabelStringUTF8 = [descriptionStringPreFormatted stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"descriptionStringPreFormatted is %@", descriptionStringPreFormatted);
NSLog(@"descriptionLabelStringUTF8 is %@", descriptionLabelStringUTF8);
여기에 내가 UTF8 인코딩을 사용하는지 동일한 출력이 나 아니.
출력 :
2013-01-05 16:44:51.807 descriptionStringPreFormatted is £144.99...
2013-01-05 16:44:51.810 descriptionLabelStringUTF8 is £144.99...
문자열이 무엇을 기대합니까? 또한 NSString 기본적으로 내부적으로 utf8 문자열 데이터를 저장할 것이라고 생각합니다 –
문자열 중 일부가 표시됩니다 : "£ 144.99 ..."대신 "£ 144.99 ..."£ 기호 infront "참고". 소스에서 문자열을 "£ 144.99 ..."로 표시하고 있으므로 무슨 일이 일어나는지 잘 모르겠습니다. – hanumanDev
어떻게 문자열을 만드시겠습니까? –