Working with TextIO Codepage
Many X++ developers will have used the TextIO class to write files at some point. Generally we will use it as such:
MyTextIO = new TextIO(MyFile, #IO_Write);
There is an optional 3rd parameter to the new method of the TextIO class, and this is the codepage of the output file. The actual definition of the new method from MSDN:
The default setting for codepage is UTF-16LE, which is fine if you are exporting CSV data to be opened in Excel, for example. But in the world of ERP systems, many interfaces are with older technology, and while you can't spot the difference just using something like Notepad, looking at the output file in a hex editor would of course show the difference between the default codepage and a simpler one. Certain interfaces, for example outputting payment or check information to a bank, will require a codepage such as 0 for ANSI. The MSDN entry (link below) has the full list of codepage values and what they mean.
https://msdn.microsoft.com/en-us/library/textio.new.aspx
MyTextIO = new TextIO(MyFile, #IO_Write);
There is an optional 3rd parameter to the new method of the TextIO class, and this is the codepage of the output file. The actual definition of the new method from MSDN:
public void new(
str filename,
str mode,
[int codepage])
The default setting for codepage is UTF-16LE, which is fine if you are exporting CSV data to be opened in Excel, for example. But in the world of ERP systems, many interfaces are with older technology, and while you can't spot the difference just using something like Notepad, looking at the output file in a hex editor would of course show the difference between the default codepage and a simpler one. Certain interfaces, for example outputting payment or check information to a bank, will require a codepage such as 0 for ANSI. The MSDN entry (link below) has the full list of codepage values and what they mean.
https://msdn.microsoft.com/en-us/library/textio.new.aspx
Comments
Post a Comment