Java - URLDecoder.decode(String s) vs URLDecoder.decode(String s, String enc)
问题 What is the difference between URLDecoder.decode(String s) and URLDecoder.decode(String s, String enc) I had a Cookie value like val=%22myvalue%22 I am retirieving it. Cookie[] cookies=request.getCookies(); String val=cookies[0].getValue(); But the value of val is %22myvalue%22 So I tried URLDecoder String val1=URLDecoder.decode(val); String val2=URLDecoder.decode(val,"utf8"); And values of both are same, that is myvalue So what is the difference between both? 回答1: URLDecoder.decode(String s)