<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"
CONTENT="no-cache">
</head>
<body>
<form name="form" method="post">
<%
String theString = null;
PrintWriter pw = null;
String cmntbox = "";
ServletOutputStream outStream = null;
try {
Connection con = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = null;
InputStream sImage;
con = DBConnection.getConnection();
sql = SELECT statement
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
while (rs.next()) {
byte bytearray[] = new byte[1048576];
String newLine = System.getProperty("line.separator");
sImage = rs.getBinaryStream(1);
StringWriter writer = new StringWriter();
request.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=UTF-8");
pw =response.getWriter();
IOUtils.copy(sImage, writer);
theString = writer.toString();
pw.write(theString);
pw.flush();
cmntbox = Utility.getCommentPage(id,prcs_area);
String comment = new String(cmntbox.getBytes("UTF-16LE"),"UTF-8");
pw.write(comment);
pw.flush();
pw.close();
}
Above pasted is the code.
I am getting output as
<�h�3�>�C�o�m�m�e�n�t�s�<�/�h�3�>� �<�t�a�b�l�e�>�<�t�r�
�b�g�c�o�l�o�r�=�'�#�E�7�E�7�E�F�'�>�<�t�d�>�P�o�s�t�e�d�
�O�n�:� �1�2�-�1�3�-�2�0�1�0� �1�0�:�3�8�:�2�4� �,� �B�y�:
And this output is coming only for few pages.For other pages it works fine
Any suggestions for the problematic output.