-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
This issue was reported by Marcin Nowak from Jabil
Please add UTF_8_BOM option for Encoding. This will fix issue generating CSV files in Polish Language. It can be done in very simple way:
- Add UTF_8_BOM (Caption UTF-8-BOM) to StandardEncodings Enumeration in Mendix Studio Pro
- Add this to StringUtils.java from communitycommons:
public static void stringToFileUtf8Bom(IContext context,
String value,
FileDocument destination) throws IOException {
if (destination == null) {
throw new IllegalArgumentException("Destination file is null");
}
if (value == null) {
throw new IllegalArgumentException("Value to write is null");
}
// Prepend BOM as U+FEFF, then write with standard UTF-8
stringToFile(context, "\uFEFF" + value, destination, StandardCharsets.UTF_8);
}- Replace function public java.lang.Boolean executeAction() throws Exception in StringToFile.java from communitycommons.actions:
public java.lang.Boolean executeAction() throws Exception
{
// BEGIN USER CODE
if (this.encoding == communitycommons.proxies.StandardEncodings.UTF_8_BOM) {
StringUtils.stringToFileUtf8Bom(getContext(), value, destination);
return true;
}
Charset charset = StandardCharsets.UTF_8;
if (this.encoding != null)
charset = Charset.forName(this.encoding.name().replace('_', '-'));
StringUtils.stringToFile(getContext(), value, destination, charset);
return true;
// END USER CODE
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels