0

I am using the following code to support UTF-8 in jsp. Please look at this :

JSP Code : editDistList.jsp

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

But when response is sent over the server with the post parameter (see the screenshots below), the value is not save in UTF-8 for that particular text and it displays other characters. I am using αβγδεζηθ characters (taken help from http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_script_charset ) but it displays αβγδεζηθin "ISO-8859-1".

enter image description here

enter image description here

I don't know why i am getting the garbage characters. I need to get UTF-8 characters which i have entered in text field somewhere. The static text displayed on same jsp page are displayed well. I used native2ascii to convert those characters to unicode-escape characters. But the problem is with dynamic text.

Please help..

vermaraj
  • 634
  • 3
  • 10
  • 34
  • Check this out: http://stackoverflow.com/questions/7170496/problems-with-utf-8-encoding-jsp-jquery-spring – Prasad Jun 30 '14 at 14:32

1 Answers1

1

You insert

<meta charset="UTF-8"/>

into <head></head> pair tags.

Or you use this template for *.jsp files:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>

<head>
    <title></title>
    <meta charset="UTF-8"/>
</head>

<body>
<%--Contents--%>
</body>

</html>
Vy Do
  • 46,709
  • 59
  • 215
  • 313