Graham Powell wrote:
> I am currently testing with 3 FTP sites and none of them work with
> Unicode characters. The "OPTS UTF8 ON" returns unsupported. 

Well, OPTS UTF8 was always unoffical, what does the FEAT command
return is much more important, in latest OverbyteIcsFtpTst demo
I show how to handle it, also follow the links in the comments:
    
procedure TFtpReceiveForm.FtpClient1RequestDone(
    Sender  : TObject;
    RqType  : TFtpRequest;
    ErrCode : Word);
var
    Cli : TFtpClient;
begin
    Cli := TFtpClient(Sender);
    Display('Request ' + LookupFTPReq (RqType) + ' Done.');
    Display('StatusCode = ' + IntToStr(Cli.StatusCode));
    Display('LastResponse was : ''' + Cli.LastResponse + '''');
    if ErrCode = 0 then
        Display('No error')
    else
        Display('Error = ' + IntToStr(ErrCode) +
                ' (' + Cli.ErrorMessage + ')');

    { Display last progress value }
    InfoLabel.Caption := IntToStr(FProgressCount);

    if ErrCode = 0 then begin
        case RqType of
            ftpFeatAsync,
            ftpConnectFeatAsync,
            ftpConnectFeatHostAsync :
                { If the server supports rfc 2640 we turn UTF-8 ON.            }
                { see also http://wiki.filezilla-project.org/Character_Set     }
                { For backward compatibility with servers that implement       }
                { the long expired IETF draft                                  }
                { http://tools.ietf.org/html/draft-ietf-ftpext-utf-8-option-00 }
                { it is also required to send the OPTS UTF8 ON command and to  }
                { ignore a possible error response.                            }
                if ftpFeatUtf8 in Cli.SupportedExtensions then begin
                    { Sets property CodePage as well in Edit's OnChange }
                    CodePageEdit.Text := IntToStr(CP_UTF8);
                    Display('Server seems to support RFC 2640 - UTF-8 turned 
on');
                end;

            ftpOptsAsync :
                { Opts UTF8 ON is only required for backward compatibility }
                { with servers not implementing rfc 2640 properly.         }
                if Cli.NewOpts = 'UTF8 ON' then
                    CodePageEdit.Text := IntToStr(CP_UTF8)
                else if Cli.NewOpts = 'UTF8 OFF' then
                    CodePageEdit.Text := IntToStr(CP_ACP);

-- 
Arno
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to