Re: Idftp.Put utf8 problem

Giganews Newsgroups
Subject: Re: Idftp.Put utf8 problem
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Tue, 2 Jun 2009

"explorer" <explorer.…> wrote in message

> Here if FTPFileName is Englishname, it's OK. if FTPFileName
> contains chinese name, eg: "?? Microsoft Visio ??.vsd",
> the file uploaded on the server becomes "D??¨ Microsoft Visio ??í?.vsd".

Indy in D7 uses AnsiString.  Chinese requires Unicode, and thus you cannot
store Chinese characters into an AnsiString without encoding it first.  Indy
in D7 does not support such encoded AnsiStrings.

> I saw IssueFEAT in TIdftp.pas, and it will SendCmd('OPTS UTF8 ON'),
> and FileZilla returns 200. So I guess it's because INDY assumes
> the DestFilename as UTF8 format, but acctually the DestFilename
> is Ansistring.

When UTF-8 is enabled, TIdFTP in D7 will convert the input AnsiString to a
WideString, then encode that to UTF-8, and then finally sends those bytes to
the server.  What you are seeing is a conversion problem at the RTL/OS
level, likely during the AnsiString->WideString stage.  The '?' characters
mean the source characters in those positions could not be converted
properly.  That is not surprising since you can't store Chinese characters
into an AnsiString to begin with.

Remy Lebeau (TeamB)



In response to

Idftp.Put utf8 problem posted by explorer on Tue, 02 Jun 2009