js

var str="好人一生平安";
encodeURI(str)          编码
decodeURI(str)          解码


java

URLEncoder.encode("好人","UTF-8") 编码
URLDecoder.decode(input, "UTF-8"); 解码