Notifications
Announcements
No record found.
How to export CSV file using x++ in UTF8 format without BOM?
Can someone help with sample code here?
*This post is locked for comments
Hi SomuAx2012,
Please elaborate. What exactly do you mean with BOM here? What data needs to be exported and where exactly do you need help?
Thanks for your reply Andre. I am trying to develop a custom transaction data CSV export. I am required to export the CSV in UTF8 format with out BOM(Byte Order Mark).
I am exporting the csv using CommaTextIo io = new TextIo(filename, 'W', 65001);
Now trying to figure out how I can export the same without BOM.
Please check this thread community.dynamics.com/.../220574 discussing similar question.
System.IO.File::WriteAllText(@'C:\test.txt', "Data 123", encoding);
This writes the file when I have simple string like one shown above. When I have multiple lines in my file I am trying concatenating multiple lines using '\n' to make one big string so I can use this code. But that results in creating a file with 0kb. Please suggest.
There is an code sample in that thread, create you file as you do using commaTextIo and then rewrite it using new encoding System.IO.File::WriteAllText(filename, System.IO.File::ReadAllText(filename), encoding);
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2