java - HttpServletRequest UTF-8 Encoding -
this question has answer here:
i saw lot of question mine not single answer works... here's thing : want parameters request (characters accents) doesn't work. tried user request.setcharacterencoding( "utf-8" )
didn't work either.
i know urldecoder.decode( request.getquerystring(), "utf-8" )
returns me rights characters request.getparametervalues()
doesn't work ! have idea ?
thank
paul's suggestion seems best course of action, if you're going work around it, don't need urlencoder or urldecoder @ all:
string item = request.getparameter("param"); byte[] bytes = item.getbytes(standardcharsets.iso_8859_1); item = new string(bytes, standardcharsets.utf_8); // java 6: // byte[] bytes = item.getbytes("iso-8859-1"); // item = new string(bytes, "utf-8");
update: since getting lot of votes, want stress balusc's point not solution; workaround @ best. people should not doing this.
i don't know caused original issue, suspect url utf-8 encoded, , utf-8 encoded again.
Comments
Post a Comment