Skip to content

Instantly share code, notes, and snippets.

@sagnitude
Created November 1, 2018 11:43
Show Gist options
  • Save sagnitude/a592f759d866c4df9188a27227d942bb to your computer and use it in GitHub Desktop.
Save sagnitude/a592f759d866c4df9188a27227d942bb to your computer and use it in GitHub Desktop.
Force java run program under encoding
System.setProperty("file.encoding", "UTF-8");
Field charset = Charset.class.getDeclaredField("defaultCharset");
charset.setAccessible(true);
charset.set(null, null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment