码迷,mamicode.com
首页 > 其他好文 > 详细

emoji表情转码

时间:2020-09-17 21:05:45      阅读:78      评论:0      收藏:0      [点我收藏+]

标签:set   nta   pat   password   encode   code   utf-8   pass   with   

iOS

编码

[@"带表情的字符串" stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLPathAllowedCharacterSet]];

URLFragmentAllowedCharacterSet  "#%<>[\]^`{|}
URLHostAllowedCharacterSet      "#%/<>?@\^`{|}
URLPasswordAllowedCharacterSet  "#%/:<>?@[\]^`{|}
URLPathAllowedCharacterSet      "#%;<>?[\]^`{|}
URLQueryAllowedCharacterSet     "#%<>[\]^`{|}
URLUserAllowedCharacterSet      "#%/:<>?@[\]^`

解码

[@"编码过带表情的字符串" stringByRemovingPercentEncoding];
Android

编码

URLEncoder.encode( "带表情的字符串", "UTF-8" );

解码

URLDecoder.decode( "编码过带表情的字符串", "UTF-8" )

emoji表情转码

标签:set   nta   pat   password   encode   code   utf-8   pass   with   

原文地址:https://blog.51cto.com/2254359459/2531262

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!