View Issue Details

IDProjectCategoryView StatusLast Update
0000761Double CommanderPluginspublic2019-06-08 15:29
ReporterSkomorokh Assigned ToAlexx2000  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
PlatformPCOSWindowsOS VersionALL
Product Version0.5.7Product Build5310 
Summary0000761: Error in list of file names that return plugin; Ошибки в именах файлов, получаемых с ftp сервера.
DescriptionPlugin must return ANSI strings but strings are UTF8.
Плагин должен возвращать имена файлов в ANSI, а вместо этого возвращает в UTF8.
Steps To ReproduceOpen ftp where exist non english file names for example russian.
Зайти на ftp, на котором находятся файлы с именами, отличными от англ., например с русскими символами.
TagsNo tags attached.
Attached Files
ftp_plug.patch (5,874 bytes)   
--- D:/lazarus/!/ftp_plug0/ftpfunc_ok.pas	�� �� 20 23:53:49 2013
+++ D:/lazarus/!/ftp_plug0/ftpfunc.pas	�� ��� 19 19:11:56 2012
@@ -111,9 +111,7 @@ var
 implementation
 
 uses
-  IniFiles, StrUtils, FtpUtils, FtpConfDlg, syncobjs, ssl_openssl//;
-  //+++
-  ,FileUtil;
+  IniFiles, StrUtils, FtpUtils, FtpConfDlg, syncobjs, ssl_openssl;
 
 var
   ActiveConnectionList, ConnectionList: TStringList;
@@ -391,13 +389,11 @@ end;
 function EditConnection(ConnectionName: AnsiString): Boolean;
 var
   I: Integer;
-  I_AC:Integer;//++
 begin
   Result:= False;
   if HasDialogAPI then
     begin
       I := ConnectionList.IndexOf(ConnectionName);
-      I_AC := ActiveConnectionList.IndexOf(ConnectionName);
       if I >= 0 then
         begin
           gConnection:= TConnection(ConnectionList.Objects[I]);
@@ -410,14 +406,6 @@ begin
                     Password:= EmptyStr;
                 end;
               WriteConnectionList;
-
-              ConnectionList[I] := gConnection.ConnectionName;//+++
-              if I_AC >= 0 then//+++
-                begin//+++
-                  TFTPSendEx(ActiveConnectionList.Objects[I_AC]).Logout;//+++
-                  TFTPSendEx(ActiveConnectionList.Objects[I_AC]).Free;//+++
-                  ActiveConnectionList.Delete(I_AC);//+++
-                  end;//+++
               Result:= True;
             end;
           gConnection:= nil;
@@ -478,12 +466,10 @@ var
   sConnName: AnsiString;
 begin
   Result := False;
-
   if (ExtractFileDir(sPath) = PathDelim) then Exit;
   sConnName := ExtractConnectionName(sPath);
   RemotePath := ExtractRemoteFileName(sPath);
   Result:= FtpConnect(sConnName, FtpSend);
-
 end;
 
 function LocalFindNext(Hdl: THandle; var FindData: TWin32FindData): Boolean;
@@ -498,7 +484,7 @@ begin
   FillChar(FindData, SizeOf(FindData), 0);
   if I < RootCount then
   begin
-    StrPCopy(FindData.cFileName, UTF8ToSys(RootList[I]));//+++
+    StrPCopy(FindData.cFileName, RootList[I]);
     FindData.dwFileAttributes := 0;
     Inc(ListRec^.Index);
     Result := True;
@@ -506,7 +492,7 @@ begin
   else if I - RootCount < ConnectionList.Count then
   begin
     Connection := TConnection(ConnectionList.Objects[I - RootCount]);
-    StrPCopy(FindData.cFileName, UTF8ToSys(Connection.ConnectionName));//+++
+    StrPCopy(FindData.cFileName, Connection.ConnectionName);
     FindData.dwFileAttributes := FILE_ATTRIBUTE_NORMAL;
     Inc(ListRec^.Index);
     Result := True;
@@ -526,7 +512,7 @@ begin
       if I < FtpList.Count then
       begin
         FillChar(FindData, SizeOf(FindData), 0);
-        StrPCopy(FindData.cFileName, UTF8ToSys(FtpList.Items[I].FileName));//+++
+        StrPCopy(FindData.cFileName, FtpList.Items[I].FileName);
         FindData.dwFileAttributes := FindData.dwFileAttributes or FILE_ATTRIBUTE_UNIX_MODE;
         if FtpList.Items[I].Directory then
           FindData.dwFileAttributes := FindData.dwFileAttributes or FILE_ATTRIBUTE_DIRECTORY
@@ -563,9 +549,6 @@ var
   sPath: AnsiString;
   FtpSend: TFTPSendEx;
 begin
-
-  Path:=PChar(SysToUTF8(Path));//+++
-
   New(ListRec);
   ListRec.Path := Path;
   ListRec.Index := 0;
@@ -635,8 +618,6 @@ begin
   Result:= FS_EXEC_YOURSELF;
   if (RemoteName = '') then Exit;
 
-  RemoteName:=PChar(SysToUTF8(RemoteName));//+++
-
   if Verb = 'open' then
     begin
       if (ExtractFileDir(RemoteName) = PathDelim) then // root path
@@ -698,9 +679,6 @@ begin
 
   if not Move then Exit;
 
-  OldName:=PChar(SysToUTF8(OldName));//+++
-  NewName:=PChar(SysToUTF8(NewName));//+++
-
   if (ExtractFileDir(OldName) = PathDelim) and (AnsiChar(OldName[1]) <> '<') then
     begin
       I:= ConnectionList.IndexOf(OldName + 1);
@@ -709,18 +687,9 @@ begin
       else
         begin
           TConnection(ConnectionList.Objects[I]).ConnectionName:= ExtractFileName(NewName);
-          ConnectionList[I] := ExtractFileName(NewName);//+++
           WriteConnectionList;
           Result:= FS_FILE_OK;
         end;
-      I:= ActiveConnectionList.IndexOf(OldName);//+++
-      if I >= 0 then//+++
-        begin//+++
-          TFTPSendEx(ActiveConnectionList.Objects[I]).Logout;//+++
-          TFTPSendEx(ActiveConnectionList.Objects[I]).Free;//+++
-          ActiveConnectionList.Delete(I);//+++
-        end;//+++
-
     end
   else if GetConnectionByPath(OldName, FtpSend, sOldName) then
     begin
@@ -741,9 +710,6 @@ var
   FtpSend: TFTPSendEx;
 begin
   Result := FS_FILE_READERROR;
-
-  RemoteName:=PChar(SysToUTF8(RemoteName));//+++
-
   if GetConnectionByPath(RemoteName, FtpSend, sFileName) then
   begin
     FtpSend.DataStream.Clear;
@@ -769,9 +735,6 @@ var
   FtpSend: TFTPSendEx;
 begin
   Result := FS_FILE_WRITEERROR;
-
-  RemoteName:=PChar(SysToUTF8(RemoteName));//+++
-
   if GetConnectionByPath(RemoteName, FtpSend, sFileName) then
   begin
     FtpSend.DataStream.Clear;
@@ -804,9 +767,6 @@ var
   FtpSend: TFTPSendEx;
 begin
   Result := False;
-
-  RemoteName:=PChar(SysToUTF8(RemoteName));//+++
-
   // if root path then delete connection
   if (ExtractFileDir(RemoteName) = PathDelim) and (AnsiChar(RemoteName[1]) <> '<') then
     Result:= DeleteConnection(ExtractConnectionName(RemoteName))
@@ -820,9 +780,6 @@ var
   FtpSend: TFTPSendEx;
 begin
   Result := False;
-
-  RemoteDir:=PChar(SysToUTF8(RemoteDir));//+++
-
   if GetConnectionByPath(RemoteDir, FtpSend, sPath) then
     Result := FtpSend.CreateDir(sPath);
 end;
@@ -833,9 +790,6 @@ var
   FtpSend: TFTPSendEx;
 begin
   Result := False;
-
-  RemoteName:=PChar(SysToUTF8(RemoteName));//+++
-
   if GetConnectionByPath(RemoteName, FtpSend, sPath) then
     Result := FtpSend.DeleteDir(sPath);
 end;
@@ -846,9 +800,6 @@ var
   sTemp: AnsiString;
 begin
   Result := False;
-
-  DisconnectRoot:=PChar(SysToUTF8(DisconnectRoot));//+++
-
   if GetConnectionByPath(DisconnectRoot, FtpSend, sTemp) then
   begin
     Result := FtpSend.Logout;
ftp_plug.patch (5,874 bytes)   
Fixed in Revision6017 - 6020
Operating systemWindows
WidgetsetWin32
Architecture32-bit, 64-bit

Relationships

duplicate of 0000693 closedAlexx2000 FTP plugin: incorrect implementation UFT8 charset under Windows 

Activities

Alexx2000

2013-12-30 10:19

administrator   ~0001210

Это исправляет лишь частный случай, когда сервер работает с кодировкой UTF-8. Если же сервер использует к примеру кодировку CP1251, то уже будет некорректно. Правильное решение это сделать выбор кодировки для соединения (типа как в TC).
Вообще я планирую переписать FTP с нуля, для более глубокой интеграции в DC.

Issue History

Date Modified Username Field Change
2013-11-21 14:26 Skomorokh New Issue
2013-11-21 14:26 Skomorokh File Added: ftp_plug.patch
2013-12-30 10:19 Alexx2000 Note Added: 0001210
2013-12-30 10:19 Alexx2000 Status new => feedback
2015-05-03 11:48 Alexx2000 Fixed in Revision => 6017
2015-05-03 11:48 Alexx2000 Assigned To => Alexx2000
2015-05-03 11:48 Alexx2000 Status feedback => resolved
2015-05-03 11:48 Alexx2000 Resolution open => fixed
2015-05-03 11:56 Alexx2000 Fixed in Revision 6017 => 6017, 6018
2015-05-03 11:58 Alexx2000 Relationship added duplicate of 0000693
2015-05-03 13:01 Alexx2000 Fixed in Revision 6017, 6018 => 6017 - 6020
2019-06-08 15:29 Alexx2000 Status resolved => closed