Download file via .net adds [NUL] values

I created a function that downloaded .txt files from an ftp server, using .net functions.
This works fine most of the times, but I have 1 particular error.

When the file is too small (less than 250 Bytes) and it ends with an empty line, i get the error :
Fout: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1814.

The reason is that the download adds several [NUL] values at the empty line. Below you see these values at the last line.
If I copy the fourth text line onto the fifth line, no [NUL] values will be added by the download.

ds8bahwd1535.jpg


This is the function :

q3435bnjvs2q.jpg


Is the adding of the [NUL] values a setting, or am I doing something wrong in the function?
I tried it on several ftp servers, all the same error, so I do not think it's a setting on the server.

Comments

  • Peter+is1Peter+is1 Member Posts: 174
    Hi,

    GetBuffer 'gets' also the unallocated bytes you could try with ToArray.

    Good luck, let us know if it works out.
    \\
    The truth exists in seven versions.
  • Erwin_van_den_HoutErwin_van_den_Hout Member Posts: 5
    I replaced the command GetBuffer with ToArry and now it works fine.

    Thanks!
  • Rikt-ItRikt-It Member Posts: 37
    Hi

    For us it has been some issues with file-names who has special signs as åäö ÅÄÖ but finally I found a solution.. :smile:

    jm0d979dd6yw.png

    Nav2013, Nav2013R2, Nav2015, Nav2016, ftp, dotnet, encoding, åäg




    Regards
    Christer in Stockholm, Sweden
Sign In or Register to comment.