Page 1 of 1

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

Posted: 22 Jun 2023, 16:10
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! :)