Here you can find the source of getDefaultCharset()
private static Charset getDefaultCharset()
//package com.java2s; /*//from ww w . j av a 2s. c om * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. * * This is free software; you can redistribute it and/or modify it * under the terms of the JBPM BPEL PUBLIC LICENSE AGREEMENT as * published by JBoss Inc.; either version 1.0 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ import java.io.InputStreamReader; import java.nio.charset.Charset; public class Main { private static Charset getDefaultCharset() { String charsetName; try { // examine the de facto system property charsetName = System.getProperty("file.encoding"); } catch (SecurityException e) { charsetName = null; } if (charsetName == null) { // take the long route charsetName = new InputStreamReader(System.in).getEncoding(); } return Charset.forName(charsetName); } }