Set CodePage สำหรับการใช้ Unicode บน Windows

Post Reply
brid.surapol
Posts: 150
Joined: 11 Apr 2013, 11:43

Set CodePage สำหรับการใช้ Unicode บน Windows

Post by brid.surapol »

cmd shell

Code: Select all

chcp 65001
set console codepage จาก java

Code: Select all

ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/c", "chcp", "65001").inheritIO();
Process p = pb.start();
p.waitFor();
inheritIO() causes the child process to inherit the parent's stdout. When chcp modifies the character encoding of the child stdout it actually ends up modifying the parent's encoding as well. Great success! :)
Post Reply

Return to “การใช้งาน Java และ JVM”