2

Populate datatable in c# from ftp server csv file. I can able to read csv file but the content it is giving is encoded format like'\000\3000' etc. So please help me out for this issue. Thanks in advance.

Logic:

 string ftpPath = (@"****.csv");
        FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(ftpPath));
        reqFTP.UsePassive = true;
        reqFTP.UseBinary = true;
        reqFTP.EnableSsl = false;
        reqFTP.Credentials = new NetworkCredential("user", "password");
        reqFTP.Method = WebRequestMethods.Ftp.DownloadFile;
        reqFTP.KeepAlive = true;
        reqFTP.Proxy = WebRequest.DefaultWebProxy;
        FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
        Stream responseStream = response.GetResponseStream();
        List<string> entries = new List<string>();
Sharad
  • 1,192
  • 1
  • 8
  • 20
  • Please specify how you are reading the CSV files: eg. with a FileStream, or directly from an FTP component? You'll need to set the proper encoding somewhere. The \3000 example suggests the CSV file is saved in Unicode but you're trying to open it with the wrong encoding. – Simmetric Sep 27 '17 at 10:31

0 Answers0