简体   繁体   English

从CSV文件导入时,应使用哪种编码来保留西班牙语和德语特殊字符?

[英]Importing from CSV file, what encoding should I use to conserve Spanish and German special characters?

I am importing from an Excel/OpenOffice generated CSV file into Navision (Classic Client NAV2009) with this code. 我正在使用此代码从Excel / OpenOffice生成的CSV文件导入Navision(经典客户端NAV2009)。

MyFile.Textmode(TRUE);
MyFile.OPEN('c:\temp\test.csv');
MyFile.READ(MyLine); (Text field);
MyFile.CLOSE;
CLEAR(MyRec);
MyRec.Text1 := MyLine;
MyRec.Insert;
COMMIT;

test.cvs is an export from text.xls and has this single line: test.cvs是text.xls的导出,具有以下一行:

ABC äöüßÄÜÖ éèÑñ ABCäöüßÄÜÖéèÑñ

What encoding should I use when saving this file from xls to csv so the special characters arrive in the Navision record unharmed? 将文件从xls保存到csv时应使用哪种编码,以便特殊字符不受损害地到达Navision记录中?

NAV correctly expects ASCII inputs. 导航正确地期望ASCII输入。 So what you need to do is convert it from ANSI to ASCII. 因此,您需要做的就是将其从ANSI转换为ASCII。 Applied to your code above it will be: MyRec.Text1 := AsciiFunction.Ansi2Ascii(MyLine); 上面的代码将应用于:MyRec.Text1:= AsciiFunction.Ansi2Ascii(MyLine);

Most NAV developers have this function in their "toolbox", but if you don't then you can find it here: http://dynamicsuser.net/files/storage/extra/nav/ascii_function.txt 大多数NAV开发人员在其“工具箱”中都具有此功能,但如果没有,则可以在这里找到: http : //dynamicsuser.net/files/storage/extra/nav/ascii_function.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM