图片URL包含unicode的内容,SDWebImage无法加载,需要unicode转utf-8编码之后,然后再去除url编码一下才可以加载.
NSString *imgUrl = [NSString stringWithFormat:@"https://xxx/pet_5776920_\U4f60\U597d.png"];
// 1. unicode utf-8编码
imgUrl = [NSString stringWithCString:[imgUrl cStringUsingEncoding:NSUTF8StringEncoding] encoding:NSNonLossyASCIIStringEncoding];
// https://xxx/pet_5776920_你好.png
// 2. url 编码
NSString *encodedString = [imgUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
// https://xxx/pet_5776920_%E4%BD%A0%E5%A5%BD.png