如何在Axapta 3.0中使用代码页UTF-8制作文本文件?
我不能使用
myFile = new CommaIo(myFileName, 'W', 65001);
就像我们在较新版本的Axapta中一样。在Axapta 3.0中,new CommaIo
只有前两个参数。
我尚未在3.0中工作,但我为您提供了一些想法,可能会为您提供正确的方法。
1)你有CommaTextIo
还是TextIo
?这些是您可以在其中指定代码页的对象。
2)在中AOT
查看并查看是否有一个名为的宏#File
,在内部查看是否具有#utf8Format(65001)
,请使用X-Ref(或Ctrl + F)在系统中查找使用该宏的其他位置。然后,您可以看到他们可能会如何完成UTF-8
3)查看是否可以CommaIo
与某些.NET代码结合使用,还是仅手动生成CSV。也许生成您的CSV并将其写入,然后使用以下方法(从MetadataXMLGenerator
作业中)读取并重新写入:
void write(str _directory, str _name, str _text)
{
str path;
;
_text = System.Text.RegularExpressions.Regex::Replace(_text, '\n', '\r\n');
if (!System.IO.Directory::Exists(_directory))
{
System.IO.Directory::CreateDirectory(_directory);
}
path = System.IO.Path::Combine(_directory, _name);
System.IO.File::WriteAllText(path, _text, System.Text.Encoding::get_UTF8());
}
非常感谢Alex。我会研究这个。