Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
Hello community,
I have a use case where the users wants to be able to export an asset structure using either the export widget or by sending an email.
In the end for both options I will create a CSV file. From the export widget and from the WriteCSVFile service to be able to attach it to an email.
The issue is that I have structures in several different languages.
Portuguese, Swedish, French and others.
What I noticed was that out of the box, both the export widget and the WriteCSVFile service provide quite strange encoding for some languages: "Associação" for what should've been: "Associação".
I found this PTC support article which provides a fix for the export widget by using the "IncludeBOM" option of the widget.
However, I can't seem to find a way to do the same with the WriteCSVFile service.
There is some setting that is described in this PTC support article.
But I don't know if I can or should use UTF-8 for everything as some languages doesn't play well with it.
Do you guys have any ideas?
A similar option as we have for the export widget might not be a bad thing in the WriteCSVFile as well.
Thanks,
Jens
Solved! Go to Solution.
Hello Communtiy,
Just in case someone comes across this post I wanted to let you know of the workaround I found.
You can manually set the UTF-8 BOM in any file by doing something like this:
// Content: STRING
let Content = Things["YourRepository"].LoadText({
path: filePath + fileName /* STRING */,
});
Things["YourRepository"].WriteToTextFile({
path: filePath + fileName /* STRING */,
offset: 0 /* NUMBER */,
data: "\ufeff" + Content /* STRING */,
});
This code will first read your file and put it in the Content variable, then we add the unicode "\ufeff" to the beginning of of the content and we then write over the file with the new contents.
This doesn't seem to break any formatting that was in the file, at least from what I've seen using it with XML and CSV.
Hoping this helps if someone else faces the same issue.
Regards,
Jens
I recommend filing a support ticket for this.
Hello Communtiy,
Just in case someone comes across this post I wanted to let you know of the workaround I found.
You can manually set the UTF-8 BOM in any file by doing something like this:
// Content: STRING
let Content = Things["YourRepository"].LoadText({
path: filePath + fileName /* STRING */,
});
Things["YourRepository"].WriteToTextFile({
path: filePath + fileName /* STRING */,
offset: 0 /* NUMBER */,
data: "\ufeff" + Content /* STRING */,
});
This code will first read your file and put it in the Content variable, then we add the unicode "\ufeff" to the beginning of of the content and we then write over the file with the new contents.
This doesn't seem to break any formatting that was in the file, at least from what I've seen using it with XML and CSV.
Hoping this helps if someone else faces the same issue.
Regards,
Jens