0
JEditorPane에 표시하려는 서버에서 HTML 응답을받습니다. 그러나 응답은 charset을 windows-1252로 설정합니다. html이 렌더링되지 않는 것으로 보입니다. (내가 그것을 주석으로 달아도 괜찮아요.)JEditorPane에서 charset = windows-1252를 사용하여 html을 표시하는 방법
그렇기 때문에 한 가지 해결책은 표시하기 전에 분석하는 것이지만 알려진 버그가 있는지 또는 응답을 편집하지 않도록 할 수있는 다른 방법이 있는지 궁금해하고 있습니다. 감사!
public static void main(String args [])
{
String html = "<!DOCTYPE HTML PUBLIC \"-////W3C////DTD HTML 4.0 Transitional//EN\">" +
"<HTML>" +
"<HEAD>" +
"<META http-equiv=Content-Type content=\"text/html; charset=windows-1252\">" +
"</HEAD>" +
"<BODY>" +
"<P>Hello World</P>" +
"</BODY>" +
"</HTML>";
JEditorPane editor = new JEditorPane("text/html", html);
editor.setEditable(false);
JScrollPane pane = new JScrollPane(editor);
JFrame f = new JFrame("charset=windows-1252");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(pane);
f.setSize(800, 600);
f.setVisible(true);
}
그걸해야합니다! 고마워. – Amber