Eclipse wrong Java properties UTF-8 encoding

前端 未结 5 2083
南旧
南旧 2020-12-28 15:19

I have a JavaEE project, in which I use message properties files. The encoding of those file is set to UTF-8. In the file I use the german umlauts like ä,

5条回答
  •  醉酒成梦
    2020-12-28 15:57

    This looks like a mixture of Eclipse and git encoding or rather not-encoding.

    Git uses raw bytes and doesn't care about encoding. Using git diff you might get characters like shown here. An example there is Rckgngig # should be "Rückgängig".

    As you can see there's two funny bracket things showing per umlaut. And in your editor, there are always two \uFFFD for each umlaut in the lines starting with +.

    So I assume that your UTF-8 editor tries to interpret the git notation and fails. This in turn leads to the representation \uFFFD, which basically meands that this is character whose value is unknown or unrepresentable (see here).

    Like suggested in the first link, you can try setting LESSCHARSET=UTF-8 in your environment variable (Windows). Hmm, in Linux it should be in etc/profile ?

提交回复
热议问题