Use some third party tools: but this will create dependency and it will cause a headache to maintain your NAV platform.
The solution I personally prefer is to use “Microsoft ActiveX Data Objects 2.8 Library” automation. In fact, this Dll is available on every windows machine and it offers a an interesting object: Stream.
In order to use it, you need to:
Know your text file encoding,
Check that your OS supports the needed language,
Use a simple code is your NAV:
Line := Stream.ReadText(1024);
Let’s see how this works concretely. In the example below, I will use a Russian Windows Server (change English to Russian):
Then, I will use two Russian text files with different encoding: UTF-8 and IBM855 (OEM 855). Finally, I test all on a NAV 2009 R2 Russian Native Demo Database.
I’ll let you see the results:
Below some comments to understand the results:
Read a IBM855 encoded file with File variable
Read a UTF-8 encoded file with File variable
Read a IBM855 encoded file with Stream automation and wrong Charset = UTF-8
Read a IBM855 encoded file with Stream automation and correct Charset = IBM855
Read a UTF-8 encoded file with Stream automation and correct Charset = UTF-8
Read a UTF-8 encoded file with Stream automation and wrong Charset = IBM855
Finally, I’ll let you download the objects and the files I used in the examples here.