Hi Jeroen,
Use GetAsString java action from SFTP module.
I hope this can help you.
Kind regards,
Domagoj
Hi Jeroen, try adding a byte order mark to the CSV file by using the java action below:
// BEGIN USER CODE
try {
/* create UTF-8 BOM byte array */
byte[] utf8BOM = {(byte) 0xEF,(byte) 0xBB,(byte) 0xBF};
/* get string from doc, add BOM */
String CSV = new String(StringUtils.stringFromFile(getContext(), csvDocument));
CSV = new String(utf8BOM) + CSV;
/* create byte result for inputstream */
byte[] result = CSV.getBytes();
/* store to mx filedoc */
Core.storeFileDocumentContent(getContext(), csvDocument.getMendixObject(), new ByteArrayInputStream(result));
return true;
} catch (Exception e) {
Core.getLogger(this.getClass().getSimpleName()).warn("Unable to add BOM " + csvDocument.getName(), e);
return false;
}
// END USER CODE
make sure to import these libraries:
import communitycommons.StringUtils;
import java.io.ByteArrayInputStream;
GL!
Fixed by using ‘String From File’ (with Encoding UTF_16LE) and ‘String to file’ (with Encoding UTF_8)