AnsweredAssumed Answered

Problem with charset

Question asked by chirlake on Nov 19, 2014
Hi!

I´ve created a document as follows:

<code java>
final String textFileName = "test.txt";
System.out.println("creating a simple text file, " + textFileName);

String mimetype = "text/plain; charset=UTF-8";
String content = "This is some test content.";
String filename = textFileName;

byte[] buf = content.getBytes("UTF-8");
ByteArrayInputStream input = new ByteArrayInputStream(buf);

ContentStream contentStream = session.getObjectFactory().createContentStream(filename, buf.length, mimetype, input);

Map<String, Object> properties = new HashMap<String, Object>();
properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
properties.put(PropertyIds.NAME, filename);

Document doc = newFolder.createDocument(properties, contentStream, VersioningState.MAJOR);
</code>

when I try to display the properties of document,

<code java>
List<Property<?>> props = doc.getProperties();
for (Property<?> p : props) {
    System.out.println(p.getDefinition().getDisplayName() + "=" + p.getValuesAsString());
}
</code>

value for Content Stream MIME Type=[text/plain], but the expected value was Content Stream MIME Type=[text/plain; charset=UTF-8]

It seems that charset is not set. Please, any help on this topic would be really appreciated.

Best regards.

Outcomes