An NDoc Documented Class Library |

# FTPConnection.CommandEncoding Property

The character-encoding to use for FTP control commands and when dealing with file- and directory-paths.

public virtual System.Text.Encoding CommandEncoding {get; set;}

#### Remarks

The default is `ASCII`, but should be changed when using file-names or directories containing non-ASCII characters.

Officially the FTP protocol (RFC959) only supports 7-bit ASCII characters. This means that file and directory names transferred across the control channel can only be ASCII. Fortunately, most servers actually support at least 8-bit ASCII. However there is no standard for what extended ASCII encoding is to be used. As a result, the meaning of characters 0 to 127 is well defined, but the meaning of characters 128 to 255 varies from one server to the other. One server might interpret character 193 as an accented A, whereas another might interpret it as an accented E.

By default, `FTPConnection` supports 7-bit ASCII. If it encounters a character whose code is 128 to 255 it will represent it as a question mark. This property allows the developer to select an 8-bit character encoding that matches that of the server. Unfortunately many servers do not state what 8-bit ASCII character set they are using, so it is often necessary to use trial and error to find out. Some common character encodings to try for western European languages are `Windows-1252` and `ISO-8859-1`.

#### See Also

FTPConnection Class | EnterpriseDT.Net.Ftp Namespace