I have a program which runs on a console and its Umlauts and other special characters are being output as ?'s on Macs. Here's a simple test program:
public static void main( String[] args ) {
System.out.println("h?h??ü?");
System.console().printf( "h?h??ü?" );
}
On a default Mac console (with default UTF-8 encoding), this prints:
h?h????
h?h????
But after manually setting the Mac terminal's encoding to "Mac OS Roman", it correctly printed
h?h??ü?
h?h??ü?
Note that on Windows systems using System.console() works:
h÷h÷?3?
h?h??ü?
So how do I make my program...rolleyes..."run everywhere"?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…