//汉字
NSString * name = @"时间终于将我对你的爱消耗殆尽";
//汉字转为百分比
NSString * encodeString = [name stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]];
NSLog(@"%@", encodeString);
encodeString = [encodeString stringByRemovingPercentEncoding];
NSLog(@"%@", encodeString);
复制代码
15:20:04 <ViewController.m> -> 35 :%E6%97%B6%E9%97%B4%E7%BB%88%E4%BA%8E%E5%B0%86%E6%88%91%E5%AF%B9%E4%BD%A0%E7%9A%84%E7%88%B1%E6%B6%88%E8%80%97%E6%AE%86%E5%B0%BD 15:20:04 <ViewController.m> -> 38 :时间终于将我对你的爱消耗殆尽