Java MozSwing 和字符集
我已成功将 mozswing 集成到我的 swing 项目中,但我对特殊字符“àèìòù”(意大利语)有疑问。
这是我的代码:
public class CreatePanel2 {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 600);
MozillaPanel moz = new MozillaPanel(MozillaPanel.VisibilityMode.FORCED_HIDDEN, MozillaPanel.VisibilityMode.FORCED_HIDDEN);
frame.getContentPane().add(moz);
frame.setVisible(true);
MozillaAutomation.blockingLoadHTML(moz, "à è ì ò ù", null); //$NON-NLS-1$
Document document = moz.getDocument();
try {
DOMUtils.writeDOMToStream(document, System.out);
} catch (IOException e) {
e.printStackTrace();
}
}
}
这是控制台输出:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html>
<head/>
<body>àè ì ò ù</body>
</html>
这是屏幕截图:
我如何更改mozswing 中的字符集?
请帮忙,谢谢! :-)
i have integrated succesfully mozswing in my swing project, but i have a problem with the special chars "àèìòù" (italians).
this is my code:
public class CreatePanel2 {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 600);
MozillaPanel moz = new MozillaPanel(MozillaPanel.VisibilityMode.FORCED_HIDDEN, MozillaPanel.VisibilityMode.FORCED_HIDDEN);
frame.getContentPane().add(moz);
frame.setVisible(true);
MozillaAutomation.blockingLoadHTML(moz, "à è ì ò ù", null); //$NON-NLS-1$
Document document = moz.getDocument();
try {
DOMUtils.writeDOMToStream(document, System.out);
} catch (IOException e) {
e.printStackTrace();
}
}
}
This is the console output:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<html>
<head/>
<body>àè ì ò ù</body>
</html>
and this is a screenshot:
How i can change the charset in mozswing?
Please help, and thank you! :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了!!
我必须在元标记中设置字符集:
Solved!!
I have to set charset in a metatag: