<p>Is there a way to change the encoding used by the String(byte[]) constructor ?</p>

<p>In my own code I use String(byte[],String) to specify the encoding but I am using an external library that I cannot change.</p>

<pre><code>String src = "with accents: é à";
byte[] bytes = src.getBytes("UTF-8");
System.out.println("UTF-8 decoded: "+new String(bytes,"UTF-8"));
System.out.println("Default decoded: "+new String(bytes));
</code></pre>

<p>The output for this is :</p>

<pre>UTF-8 decoded: with accents: é à
Default decoded: with accents: Ã© Ã 
</pre>

<p>I have tried changing the system property <code>file.encoding</code> but it does not work.</p>

Quoted from
defaultCharset()
The default charset is determined
  during virtual-machine startup and
  typically depends upon the locale and
  charset of the underlying operating
  system.
In most OSes you can set the charset using a environment variable.