Garbled eclipse JSP learning problems encountered in obtaining the value of Chinese pages

性别:男<input type="radio" name="sex" value="男" />

  

String sex =request.getParameter("sex");

  This time the value of a string of sex get a garbled "?? *";

new String(sex.getBytes("iso-8859-1"),"utf-8")

  Get the number of bytes of the original (native format "iso-8859-1") by the getBytes, the number of bytes in a String, to obtain normal values ​​in UTF-8 Reconstruction

Guess you like

Origin www.cnblogs.com/AlexFung/p/12171985.html