Get unicode string in java servlet submitted from HTML form?

490 views Asked by At

I stuck up while working with Unicode(Nepali) in Servlet. Well I submit (POST Method) HTML form and wanted to store in database. But could not get exact unicode.

I tried following things -

  1. new String(request.getParameter("nameNep").getBytes("iso-8859-1"),"utf-8")

Result of above code is ?????? ???? like string

  1. byte[] utf8Bytes = request.getParameter("nameNep").("UTF8"); String text = new String(utf8Bytes,"UTF8");

this code generate text like म�द�र �न, and is actually same result as request.getParameter("nameNep")

  1. URLDecoder.decode(request.getParameter("nameNep"), "UTF-8");

same result as 2

  1. request.setCharacterSet("UTF-8"); setting this up before any action on request, got same result as 2 & 3

What i am doing mistake here , the form field nameNep contains nepali Unicode characters.

0

There are 0 answers