1

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.

Veshraj Joshi
  • 3,544
  • 3
  • 27
  • 45
  • 1
    Possible duplicate of [How to pass Unicode characters as JSP/Servlet request.getParameter?](https://stackoverflow.com/questions/10517268/how-to-pass-unicode-characters-as-jsp-servlet-request-getparameter) – Jozef Chocholacek Nov 24 '17 at 07:52

0 Answers0