如何使用get方法傳遞中文 試試看: <a href=response. jsp? tbx. Name=<%=“徐煥智”%>> 將<%=“徐煥智”%>改為 <%=java. net. URLEncoder. encode(“徐煥智”, ”utf-8”)%> To convert a String, each character is examined in turn: • The ASCII characters 'a' through 'z', 'A' through 'Z', and '0' through '9' remain the same. • The space character ' ' is converted into a plus sign '+'. • All other characters are converted into the 3 -character string "%xy", where xy is the twodigit hexadecimal representation of the lower 8 -bits of the character.
如何使用get方法傳遞中文 l 如何解碼 String keyword = new String(request. get. Parameter("keyword"). get. Bytes("iso-8859 -1"), "utf-8"); public byte[] get. Bytes(String charset. Name) Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array. public String(byte[] bytes, String charset. Name) Constructs a new String by decoding the specified array of bytes using the specified charset.
Post 方法中文傳遞 request. set. Character. Encoding("big 5");