iOS: handling HTTP request's unicode characters

前端 未结 1 1923
梦毁少年i
梦毁少年i 2021-01-27 08:00

When I NSLog HTTP requests response string, it appears as \"ãÃÂïãÃâ¬ÃÂãÃÂÃâãÃÂ\" and something different appears on UILabel but not the same as I expect in Japanese/Ch

相关标签:
1条回答
  • 2021-01-27 08:30

    I managed to fix this. Following is the change!

    ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:[dataUrl stringByAppendingFormat:@"%@",self.selectedID]]];
    [request setResponseEncoding:NSUTF8StringEncoding]; -- > Wrong!!!
    
     request.defaultResponseEncoding = NSUTF8StringEncoding; --> Correct!
    
    0 讨论(0)
提交回复
热议问题