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

Tag: excel , csv , character-encoding , navision Author: zw_angel Date: 2013-09-16

I am importing from an Excel/OpenOffice generated CSV file into Navision (Classic Client NAV2009) with this code.

MyFile.READ(MyLine); (Text field);
MyRec.Text1 := MyLine;

test.cvs is an export from text.xls and has this single line:

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

What encoding should I use when saving this file from xls to csv so the special characters arrive in the Navision record unharmed?

Other Answer1

NAV correctly expects ASCII inputs. So what you need to do is convert it from ANSI to ASCII. Applied to your code above it will be: 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: