问题描述
我收到一个字符串,它是无法正常连接codeD一样的myString%201,其中必须的myString 1我怎么会取代所有的字符可能是PTED为UTF8间$ P $?我读很多帖子,但不是一个完整的解决方案。请注意,字符串是已经连接codeD错了,我不是问怎么EN code字符序列。我前几天问同样的问题,为iOS和得到解决使用stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding谢谢
I am receiving a string that is not properly encoded like "mystring%201, where must be "mystring 1". How could I replace all characters that could be interpreted as UTF8? I read a lot of posts but not a full solution. Please note that string is already encoded wrong and I am not asking about how to encode char sequence. I asked same issue for iOS few days ago and was solved using stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding. Thank you.
功能,如:
You should be able to use the URLDecoder.decode() function, like this:
String s = URLDecoder.decode(myString, "UTF-8");
此处了解详情:<一href=\"http://stackoverflow.com/questions/896721/urlen$c$cr-en$c$c-urlde$c$cr-de$c$c-in-java-android\">URLEn$c$cr EN code / URLDe codeR德code在Java(Android版)
这篇关于从收到的字符串的Android UTF8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!