Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

fss1189

Posts

2

Joined

Mon Oct 29, 2012 2:06 pm

ftpConnection1.GetFiles() method can't support DBSC ?

by fss1189 » Mon Oct 29, 2012 3:57 pm

my windows form program can't put the chinese (DBCS) file name list
into listBox1 using ftpConnection1.GetFiles() method;



private void connectButton_Click(object sender, System.EventArgs e)
{
try
{ // Clear the list-box
listBox1.Items.Clear();

// Set server and log-in properties
ftpConnection1.ServerAddress = serverTextBox.Text;
ftpConnection1.ServerPort = int.Parse(portTextBox.Text);
ftpConnection1.UserName = userTextBox.Text;
ftpConnection1.Password = passwordTextBox.Text;

// Connect, get files and close
ftpConnection1.Connect();
ftpConnection1.ChangeWorkingDirectory("/1234567890/fmFSS");
listBox1.Items.AddRange(ftpConnection1.GetFiles());
ftpConnection1.Close();
}
catch (Exception ex)
{
if (ftpConnection1.IsConnected)
ftpConnection1.Close();
MessageBox.Show("Error");
}
}
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: ftpConnection1.GetFiles() method can't support DBSC ?

by support2 » Mon Oct 29, 2012 4:04 pm

Try setting the DataEncoding property to the appropriate encoding (big5?).
no avatar
User

fss1189

Posts

2

Joined

Mon Oct 29, 2012 2:06 pm

by fss1189 » Tue Oct 30, 2012 1:35 am

ftpConnection1.CommandEncoding = new UTF8Encoding(false);
ftpConnection1.DataEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
ftpConnection1.Connect();

I solved the problem.

I found the solution in forum but I don't know why ?
ftpConnection1.CommandEncoding = new UTF8Encoding(false);

who can explain why ?
no avatar
User

EDT Support

Posts

905

Joined

Mon Apr 26, 2004 3:03 pm

by EDT Support » Tue Oct 30, 2012 6:09 am

is a universal character encoding that supports all characters in all languages. It is becoming the standard. The reason Bruce suggested Big8 is that it's common for Chinese FTP servers to use that, but really UTF8 is better and will probably become the standard.

- Hans (EnterpriseDT)

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron