GWT:字符编码变音符号 [英] GWT: Character encoding umlauts

查看:155
本文介绍了GWT:字符编码变音符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在标签中设置一个文本:

I want to set a text in a label:

labelDemnaechst.setText(" Demnächst fällig:");

在应用程序的输出中,字符ä显示错误。

On the output in the application the characters "ä" are displayed wrong.

如何显示它们?

推荐答案

你必须将您的特殊字符编码为Unicode格式。您可以找到代表性的Unicode字符列表 here

well you have to encode your special charactars to Unicode. You can finde a list of the representive Unicode characters here.

您的考试将如下所示:

    labelDemnaechst.setText("Demn\u00E4lachst f\u00E4llig:");

希望这有助于,如果没有一个更好的解决方案。

Hope this helps, if noone has a better solution.

附录:

感谢Thomas为您的提示,您必须更改eclipse保存它的源文件的格式。默认情况下,它使用像Cp1252这样的东西。如果将其更改为UTF-8,您的示例将正确运行。 (所以Demnächst写得正确)。

Thanks Thomas for your tipp, you really have to change the format in which eclipse safes it's source files. Per default it uses something like Cp1252. If you change it to UTF-8, your example works correct. (So Demnächst is written correctly).

如果您右键单击文件 - >首选项,您可以编辑安全格式。

You can edit the safing format, if you right-click on your file --> Preferences.

这篇关于GWT:字符编码变音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆