iOS \U7ea2 乱码 转换
通常网络请求的数据,如果不做处理在输出时显示是 \U 之类的编码的;
不需要导入别的类库解决方法
- (NSString *)replaceUnicode:(NSString *)unicodeStr {
NSString *tempStr1 = [unicodeStr stringByReplacingOccurrencesOfString:@"\\u" withString:@"\\U"];
NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""];
NSString *tempStr3 = [[@"\"" stringByAppendingString:tempStr2] stringByAppendingString:@"\""];
NSData *tempData = [tempStr3 dataUsingEncoding:NSUTF8StringEncoding];
NSString* returnStr = [NSPropertyListSerialization propertyListFromData:tempData
mutabilityOption:NSPropertyListImmutable
format:NULL
errorDescription:NULL];
return [returnStr stringByReplacingOccurrencesOfString:@"\\r\\n" withString:@"\n"];
}
iOS \U7ea2 乱码 转换的更多相关文章
- java(IO)读写文件乱码转换UTF-8问题
java(IO)读写文件乱码转换UTF-8问题 读取文件 String Content = ""; // 文件很长的话建议使用StringBuffer try { FileInpu ...
- ios坐标位置转换
//ios常用坐标转换来处理一些下拉框队形的按钮的位置,我以最下面两个来进行一下个人的理解,不足之处多多见谅 - (CGPoint)convertPoint:(CGPoint)point toView ...
- IOS 时间字符串转换时间戳失败问题
链接:https://pan.baidu.com/s/1nw6VWoD 密码:1peh 有时候获取到的时间带有毫秒数或者是(2018-2-6 11:11:11)格式的(别说你没遇到过,也别什么都让后台 ...
- ios日期格式转换
转自:http://blog.csdn.net/l_ch_g/article/details/8217725 1.如何如何将一个字符串如“ 20110826134106”装化为任意的日期时间格式,下面 ...
- iOS 集成Protobuf,转换proto文件
原文地址:http://blog.csdn.net/hyq4412/article/details/54891038 附加Homebrew安装地址:https://brew.sh/index_zh-c ...
- iOS 时间戳的转换
在开发iOS程序时,有时候需要将时间格式调整成自己希望的格式,这个时候我们可以用NSDateFormatter类来处理.例如: //实例化一个NSDateFormatter对象 NSDateForma ...
- ios Push证书 转换步骤
1.将aps_developer_identity.cer转换成aps_developer_identity.pem格式openssl x509 -in aps_developer_identity. ...
- iOS 秒数转换成时间,时,分,秒
//转换成时分秒 - (NSString *)timeFormatted:(int)totalSeconds{ int seconds = totalSeconds % 60; int min ...
- IOS时间格式转换
在开发iOS程序时,有时候需要将时间格式调整成自己希望的格式,这个时候我们可以用NSDateFormatter类来处理. 例如:如何将格式为“12-May-14 05.08.02.000000 PM” ...
随机推荐
- wikioi 1080 线段树练习 树状数组
1080 线段树练习 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题目描述 Description 一行N个方格,开始每个格子里都有一个整数.现 ...
- MVC基类控制器的会话丢失重新登录权限过滤
SSOController.cs请查看以下代码: public class SSOController : Controller { public const string Token = " ...
- redis学习之一 - linux下安装配置
Content 0.序 1.如何安装? 2.配置参数及其意义 3.设为linux服务 0.序 本文主要是记录Redis在 Centos下的安装配置 .文中如无特别说明.表示redis-3.2.10代码 ...
- 仿querySeletor 兼容IE 67
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Non-Inverting Level Shifter : +/-5V signal into a 0 to 3.3V
http://electronicdesign.com/boards/non-inverting-level-shifter-requires-only-one-op-amp-one-supply-v ...
- HDU 2222 Keywords Search 【AC自动机模板】
询问有多少个模式串出现在了文本串里面.将模式串插入Trie树中,然后跑一边AC自动机统计一下就哦了. 献上一份模板. #include <cstdio> #include <cstr ...
- andriod 调用高德地图
Android Studio 配置工程 最后更新时间: 2017年08月29日 来自:http://lbs.amap.com/api/android-sdk/guide/cre ...
- 《Head First 设计模式》学习笔记——策略模型
我们全都使用别人设计好的库与框架.我们讨论库与框架.利用他们的API编译成我们的程序.享受运用别人的代码所带来的长处.看看java api它所带来的功能:网络.GUI.IO等.库与框架长久以来,一直扮 ...
- [翻译] DFXCoreTextView
DFXCoreTextView https://github.com/davefoxy/DFXCoreTextView A CoreText wrapper for the formatting an ...
- ORACLE 修改已有存储过程(plsql工具修改)
pl/sql 修改包下存储过程步骤: 假定有如下过程:pkg_ypgl_query.PROC_KCZQUERY; 1. pl/sql 右侧objects面板中选择Package bodies>P ...