Wednesday, July 15, 2015

X++ Export an Unicode CSV file

From the previous post. X++ create a simple CSV file.We made a simple CSV, but sometimes we need to export a field as Unicode. For example the japanese font.

We probably get the result file like as below.







We can fix this issue easily by enhance the existing code a bit.
from
private void closeFile()
{
    textBuffer.toFile(fileName);    
    CodeAccessPermission::revertAssert();
}

to
private void closeFile()
{
    textBuffer.toFile(fileName, FileEncoding::UTF8);    
    CodeAccessPermission::revertAssert();
}

The result looks nice eventually.

No comments:

Post a Comment