1

利用した

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();

クライアントブラウザでは、次のように出力されています

ÿþ<�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�i�c�e�:�p�o�w�e�r�p�o�i�n�t�"� � �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�"� �

これを知っている人がいたら、どうすればこの問題を解決できますか

4

1 に答える 1

1

これを使用してみてください:

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

確かに、テキストが ISO-8859-1 になるわけではありませんが、最近のほとんどのブラウザは問題なく UTF-16 をサポートしています。

于 2010-11-11T03:47:48.620 に答える