hi.
I have a problem of encoding in server side (in the bean) .I want to pass values to the bean in utf-8 and not in iso-8895-1 , I read about this problem and tried everything that was suggested.
I work with tomcat 5.5.12 on windows Server 2003 . with java 1.5.0.2
at my top of the jsp I have :
<%@ page pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
also I have these lines:
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=UTF-8");
I have a problem of encoding in server side (in the bean) .I want to pass values to the bean in utf-8 and not in iso-8895-1 , I read about this problem and tried everything that was suggested.
I work with tomcat 5.5.12 on windows Server 2003 . with java 1.5.0.2
at my top of the jsp I have :
<%@ page pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
also I have these lines:
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=UTF-8");
I want to set a property in my bean and then to get this value and display it but I have encoding problem probably in the point of passing the value to the bean.
it works when I used this line in the set function in the bean :
new String(iInputStr.getBytes("ISO-8859-1"),"UTF-8");
it works when I used this line in the set function in the bean :
new String(iInputStr.getBytes("ISO-8859-1"),"UTF-8");
this way,I get my String back in the jsp in the right encoding(UTF-8),but I don't understand why I need this line if I used the other lines in the jsp .
I manage to display hard coded Hebrew characters with utf-8 in my page and also to get the value of a request parameter in utf-8 .
I attached the jsp and the bean source
thanks,
Idan
Yahoo! Mail
Use Photomail to share photos without annoying attachments.
<%@ page pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<%
System.out.println("before setting encoding for response
response.getCharacterEncoding():"+response.getCharacterEncoding()+"
request.getCharacterEncoding():"+request.getCharacterEncoding());
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=UTF-8");
// response.setContentType("text/html; charset=utf-8; pageEncoding=utf-8");
//System.out.println("b4 setting encoding for response");
//response.setCharacterEncoding("utf-8");
System.out.println("after setting encoding for response
response.getCharacterEncoding():"+response.getCharacterEncoding()+"
request.getCharacterEncoding():"+request.getCharacterEncoding());
%>
<jsp:useBean id="testEncoding" class="com.modelity.utilities.EncodingTester"
scope="session"/>
<jsp:setProperty name="testEncoding" property="inputStr"/>
<html>
<head><meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<%
String iStr = testEncoding.getInputStr();
%>
<script>
</script>
</head>
<body>
<form name="mainForm" action="<%=response.encodeURL("test-idan1.jsp")%>"
method="post">
<input type="text" value="" name="inputStr"/>
<input type="submit" value="Submit" />
</form>
<br>×¢×ר×ת ×©×¤× ×§×©× - ר×ס×ת ××תר ×§×©× <br>
value:<%=iStr%>
</body>
</html>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
