Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/322.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 上传到ftp服务器后,文件名以错误的编码显示_C#_Wpf_Ftp - Fatal编程技术网

C# 上传到ftp服务器后,文件名以错误的编码显示

C# 上传到ftp服务器后,文件名以错误的编码显示,c#,wpf,ftp,C#,Wpf,Ftp,将文件上载到ftp服务器后,文件名显示为????????。文件名包含西里尔文字。但是这个文件里面显示的是正确的。如何显示正确的文件名?我的代码在这里: FileInfo fileInfo = new FileInfo(filepath); string fileName = fileInfo.Name.ToString(); WebRequest requestFTP = WebRequest.Create(IncomingFtpPath + fi

将文件上载到ftp服务器后,文件名显示为????????。文件名包含西里尔文字。但是这个文件里面显示的是正确的。如何显示正确的文件名?我的代码在这里:

        FileInfo fileInfo = new FileInfo(filepath);
        string fileName = fileInfo.Name.ToString();
        WebRequest requestFTP = WebRequest.Create(IncomingFtpPath + fileName);

        requestFTP.Credentials = new NetworkCredential(ftpusername, ftppassword);
        requestFTP.Method = WebRequestMethods.Ftp.UploadFile;
        FileStream fStream = fileInfo.OpenRead();
        int bufferLength = 2048;
        byte[] buffer = new byte[bufferLength];

        Stream uploadStream = requestFTP.GetRequestStream();
        int contentLength = fStream.Read(buffer, 0, bufferLength);

        while (contentLength != 0)
        {
            uploadStream.Write(buffer, 0, contentLength);
            contentLength = fStream.Read(buffer, 0, bufferLength);
        }
        uploadStream.Close();
        fStream.Close();
        requestFTP = null; 

你的ftp服务器支持这种类型的字符吗?好问题,我不确定。我已经检查过了,是的,它支持