如何在Android中解码字符串? [英] How to Decode String in Android?

查看:236
本文介绍了如何在Android中解码字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有一个解析器模块,它将解析来自Web服务的响应并给出标签值。标签值包含一些特殊字符,如&#174等。问题是我无法将特殊字符解码为普通字符串。请在下面找到示例响应字符串,

I have a parser module in my application which will parse the response from a webservice and give the tag value. The tag value contains some special characters like ® etc. The problem is I could not decode the special characters to normal string. please find the sample response string below,

Apple® iPad™ Case

请一些机构帮助我解决此问题。

Please some body help me to solve this problem.

推荐答案

只需使用 String result = URLDecoder.decode(string, UTF-8);

或使用

byte[] data = Base64.decode(base64, Base64.DEFAULT);
String text = new String(data, "UTF-8");

这篇关于如何在Android中解码字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆