storeFileDocumentContent and charset

In Java when I store a String to a Filedocument, I get different results depending on how the action is called. The code involved is: byte[] byteArray = stringContent.getBytes("ISO-8859-1"); InputStream inputStream = new ByteArrayInputStream(byteArray); Core.storeFileDocumentContent(context, newFile.getMendixObject(), inputStream); newFile.commit(context); When this Java action is called directly from a button/microflow as a user action, everything is fine. Special chars are fine in the resulting txt file. But when this action is executed through a Scheduled event and Core.executeAsync, the special chars are wrong. For example: é becomes � . When i use UTF-8 in the byteArray conversion, both versions get an é instead of é. Is this a bug or can I set the encoding somewhere else so this doesn't happen?
1 answers

I have seen this before. I used a workaround by creating a tempfile first by using new FileOutputStream(csvfilename, false), "Cp1252") and then copying this tempfile to the filedocument object. This way the result was consistend and I never did delve deeper because I assumed I did something wrong :)