unable to store files to S3 which has chinese character (Java)
<p>i need to save a file(String) to S3, which contains some chinese characters, and it always failed due to those character, here is my code:</p>

<pre><code># generate output stream with the file 
byte[] bytes = file.getBytes("UTF-8");
ByteArrayOutputStream out = new ByteArrayOutputStream(bytes.length);
out.write(bytes, 0, bytes.length);
byte[] bytes = out.toByteArray();
InputStream stream = new ByteArrayInputStream(bytes);

ObjectMetadata md = new ObjectMetadata();
md.setContentLength(bytes.length);
md.setContentType("text/csv;charset=UTF-8");
md.setContentEncoding("UTF-8");

# save to S3
client.putObject("myBucket", "keyName", stream, md);
</code></pre>

<p>and the error i got:</p>

<pre><code>    com.amazonaws.AmazonClientException: Unable to unmarshall error response (Character reference "&amp;#)
..

Caused by: org.xml.sax.SAXParseException: Character reference "&amp;#
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) ~[na:1.7.0_79]
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:347) ~[na:1.7.0_79]
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[na:1.7.0_79]
    at com.amazonaws.util.XpathUtils.documentFrom(XpathUtils.java:67) ~[aws-java-sdk-1.3.19.jar:na]
    at com.amazonaws.services.s3.internal.S3ErrorResponseHandler.handle(S3ErrorResponseHandler.java:63) ~[aws-java-sdk-1.3.19.jar:na]
    at com.amazonaws.services.s3.internal.S3ErrorResponseHandler.handle(S3ErrorResponseHandler.java:38) ~[aws-java-sdk-1.3.19.jar:na]
    at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:558) ~[aws-java-sdk-1.3.19.jar:na]
</code></pre>