GWT: Character encoding umlauts

后端 未结 5 1090
后悔当初
后悔当初 2021-01-12 04:24

I want to set a text in a label:

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

On the output in the application the characters \"ä\" are

5条回答
  •  不思量自难忘°
    2021-01-12 05:14

    GWT assumes all source files are encoded in UTF-8 (and this is why you see löschen if you open them with an editor that interprets them as Windows-1252 or ISO-8859-1).

    GWT also generates UTF-8-encoded files, so your web server should serve them as UTF-8 (or don't specify an encoding at all, to let browsers "sniff" it) and your HTML host page should be served in UTF-8 too (best is to put a at the beginning of your ).

    If a \u00E4 in Java is displayed correctly in the browser, then you're probably in the first case, where your source files are not encoded in UTF-8.

    See http://code.google.com/webtoolkit/doc/latest/FAQ_Troubleshooting.html#International_characters_don't_display_correctly

提交回复
热议问题