I've been scratching my head for a few days now trying to figure out how to correctly encode scandinavian characters for use in a text field
These three characters: Æ Ø Å ( æ ø å) show up as ���. meaning that the running this code
System.out.println("øst");
prints"�st" . and i have no idea why.
Here's the code where i redirect the System.out to a printstream.
System.setProperty("user.language", "da");
OutputStream out = new OutputStream() {
@Override
public void write(int b) throws IOException {
appendConsole(new String(new byte[]{(byte)b}, "UTF-8"));
}
};
PrintStream ps;
try {
ps = new PrintStream(out, true, "UTF-8");
System.setOut(ps);
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(GameController.class.getName()).log(Level.SEVERE, null, ex);
}
If anyone has a solution to this problem, it is greatly appreciated!