java url 编码

 

 

 

public static void main(String[] args) throws UnsupportedEncodingException {
        String encodeUrl = URLEncoder.encode("BF+01601RG-1", "UTF-8");//编码
        System.out.println(encodeUrl);//BF%2B01601RG-1

        String decodeUrl = URLDecoder.decode("BF%2B01601RG-1", "UTF-8");//解码
        System.out.println(decodeUrl);//BF+01601RG-1
    }

 

posted @ 2019-11-27 12:06  草木物语  阅读(1296)  评论(0编辑  收藏  举报