开发者

using stringwriter getting encoding problems

i have used

StringWriter writer = new StringWriter();
request.setCharacterEncoding("ISO-8859-1");
response.setContentType("text/html;charset=ISO-8859-1");
pw =response.getWriter();
IOUtils.copy(sImage, writer);
theString = writer.toString();
pw.write(theString);
pw.flush();

In the client browser am getting output as

ÿþ<�h�t�m�l� �x�m�l�n�s�:�v�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�v�m�l�"� � �x�m�l�n�s�:�o�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�o�f�f�i�c�e�:�o�f�f�i�c�e�"� � �x�m�l�n�s�:�w�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�o�f�f�i�c�e�:�w�o�r�d�"� � �x�m�l�n�s�:�x�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�o�f�f�i�c�e�:�e�x�c�e�l�"� � �x�m�l�n�s�:�p�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�o�f�f�i�c�e�:�p�o�w�e�r�p�o�i�n�t�"� � �开发者_JAVA技巧x�m�l�n�s�:�a�=�"�u�r�n�:�s�c�h�e�m�a�s�-�m�i�c�r�o�s�o�f�t�-�c�o�m�:�o�f�f�i�c�e�:�a�c�c�e�s�s�"� �

If any of you guys know this,how can i solve this problem


Try using this:

response.setContentType("text/html; charset=UTF-16LE");

Granted, it doesn't make your text ISO-8859-1, but, most browsers have no problem supporting UTF-16 these days.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜