NUL character in a text file read by NAV
andy76
Member Posts: 616
Hello,
we have problems with an enormous text file supplied us by ftp and containing a lot of price lists.
From yesterday we have problems and I try to debug and analyze.
Inside the text file (opened with Notepad ++) I have a lot of NUL value that I don't see with standard Notepad of Windows.
Debugging I see that the lines read are broken where there is the NUL value.
I ask you how to solve it with CSIDE code.
Actual code is
WHILE NOT gIstlFileToRead.EOS DO BEGIN
gIstlFileToRead.READTEXT(gTxtLineRead,1024);
gIstlFileToRead is a File variable
gTxtLineRead is a Text [1024]
Thank you
and then
we have problems with an enormous text file supplied us by ftp and containing a lot of price lists.
From yesterday we have problems and I try to debug and analyze.
Inside the text file (opened with Notepad ++) I have a lot of NUL value that I don't see with standard Notepad of Windows.
Debugging I see that the lines read are broken where there is the NUL value.
I ask you how to solve it with CSIDE code.
Actual code is
WHILE NOT gIstlFileToRead.EOS DO BEGIN
gIstlFileToRead.READTEXT(gTxtLineRead,1024);
gIstlFileToRead is a File variable
gTxtLineRead is a Text [1024]
Thank you
and then
0
Comments
-
First of all I recommend you contact the originator of the file and ask for a corrected file. A file containing NUL characters is generally considered to be a binary file, not a text file (unless almost every second char is NUL, in which case it is likely in UTF-16 encoding).
Other options you have:- fix the file yourself before you read it with NAV
- read the file as it is and try to detect breaks caused by NUL characters and join strings as needed
- read the file as binary, fix the NUL characters (as you should not place these in NAV fields), then split into lines in code and proceed
No, it's an InStream. You might want to check File.READ with TEXTMODE TRUE or FALSE also.andy76 wrote:gIstlFileToRead is a File variable0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
