The SetFileNameEncoding method can be used to enable UTF-8
encoding of file names, which provides improved support for the use
of international character sets. However, the server must provide
support for UTF-8 encoding by advertising it in response to the FEAT
command and it must support the OPTS command which is used to enable
UTF-8 encoding. If the server does not advertise support for UTF-8,
or the OPTS command fails with an error, then this method will fail
with an error and the encoding type will not change.
Although it is possible to use the EnableFeature method to
explicitly enable the FTP_FEATURE_UTF8 feature, this is not
recommended. If the server has not advertised support for UTF-8
encoding in response to the FEAT command, that typically indicates
that UTF-8 encoding is not supported. Attempting to force UTF-8
encoding can result in unpredictable behavior when file names contain
non-ASCII characters.
It is important to note that not all FTP servers support UTF-8
encoding, and in some cases servers which advertise support for UTF-8
encoding do not implement the feature correctly. For example, a
server may allow a client to enable UTF-8 encoding, but once enabled
will not permit the client to disable it. Some servers may advertise
support for UTF-8 encoding, however if the underlying file system
does not support UTF-8 encoded file names, any attempt to upload or
download a file may fail with an error indicating that the file
cannot be found or created.