【发布时间】:2011-11-30 11:22:01
【问题描述】:
我使用 JTextPane 作为简单的 html 编辑器。
jtp=new JTextPane();
jtp.setContentType("text/html;charset=UTF-8");
jtp.setEditorKit(new HTMLEditorKit());
当我调用 jtp.getText() 时,我得到了很好的 html 代码,其中所有特殊字符都已转义。但我不想转义国家字符(波兰语),而只想转义特殊的 html 字符,如 &、 当我进入编辑器时
<foo>ą ś &
我明白了
<foo>ą ś &
但我想得到
<foo>ą ś &
怎么可能?
【问题讨论】:
-
我使用
charset=cp1251而不是charset=UTF-8 -
标签: java utf-8 character-encoding html-entities jtextpane