android UTF8 encoding from received string

前端 未结 3 1829
清歌不尽
清歌不尽 2021-02-14 02:06

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 inte

3条回答
  •  青春惊慌失措
    2021-02-14 02:40

    Looks like your string is partially URL-encoded, so... how about this:

    try {
     System.out.println(URLDecoder.decode("mystring%201", "UTF-8"));
    } catch(UnsupportedEncodingException e) {
     e.printStackTrace();
    }
    

提交回复
热议问题