2
4

2 回答 2

0

Okay, I assume you are using org.eclipse.ui.console.MessageConsole, which extends IOConsole. If you take a look at the IOConsole class, there is a getEncodingMethod(), which return default encoding, which is taken from WorkbenchEncoding.getWorkbenchDefaultEncoding();, which is System.getProperty("file.encoding", "UTF-8");. So, you could try to set property "file.encoding" to desired encoding. Hope this helps.

于 2012-09-25T09:47:33.130 回答
0

The easiest way of printing German umlauts to the console correctly is to use System.console() and the methods it provides.

Another way is to configure the encoding to be used externally, via a system property for example. Then the application has to use that encoding to create the necessary Writer, Readers and Streams. For Windows systems this encoding has to be IBM850.

The problem is that in Windows the default encoding Cp1252 is used also for System.out and System.in. But the windows console uses codepage 850 (a legacy from DOS times), which correspondents to the encoding IBM850 in Java. Since Cp1252and IBM850 are not compatible the characters get messed up.

于 2012-09-26T08:57:43.417 回答