用ftp编码的字符

时间:2015-07-17 11:18:07

标签: vb.net text encoding ftp byte

我正在尝试将从字符串文本创建的文件上传到我的ftp服务器,但我遇到了编码问题:

Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.myserver.com/" & Now.Day & Now.Month & Now.Year & Now.Hour & Now.Minute & ".txt"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential("myusername", "mypassword")
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile

Dim File() As Byte = System.Text.Encoding.ASCII.GetBytes(log)
Dim strZ As System.IO.Stream = request.GetRequestStream()
strZ.Write(File, 0, File.Length)
strZ.Close()
strZ.Dispose()

日志变量是一个字符串,我在将字符串转换为字节数组时尝试了ascii / utf8 / unicode,但是,上传到ftp的文件仍然没有显示很多字符,如“é”,任何人可以帮帮我吗?

0 个答案:

没有答案