Ticket #1464: filezilla_utf8.patch
File filezilla_utf8.patch, 28.9 KB (added by , 20 years ago) |
---|
-
CommandQueue.cpp
diff -Nur source/CommandQueue.cpp source.utf8/CommandQueue.cpp
old new 68 68 COptions::SetOption(OPTION_LASTSERVERPORT,server.port); 69 69 COptions::SetOption(OPTION_LASTSERVERUSER,server.user); 70 70 COptions::SetOption(OPTION_LASTSERVERDONTREMEMBERPASS,server.bDontRememberPass?1:0); 71 COptions::SetOption(OPTION_LASTSERVERUSEUTF8,server.bUTF8?1:0); 71 72 COptions::SetOption(OPTION_LASTSERVERNAME,server.name); 72 73 if (!server.bDontRememberPass && !_ttoi(COptions::GetOption(OPTION_RUNINSECUREMODE))) 73 74 COptions::SetOption(OPTION_LASTSERVERPASS,CCrypt::encrypt(server.pass)); … … 777 778 server2.host=COptions::GetOption(OPTION_LASTSERVERHOST); 778 779 server2.port=COptions::GetOptionVal(OPTION_LASTSERVERPORT); 779 780 server2.user=COptions::GetOption(OPTION_LASTSERVERUSER); 781 server2.bUTF8=COptions::GetOptionVal(OPTION_LASTSERVERUSEUTF8); 780 782 server2.bDontRememberPass=COptions::GetOptionVal(OPTION_LASTSERVERDONTREMEMBERPASS); 781 783 if (!server2.bDontRememberPass) 782 784 { -
FileZilla.rc
diff -Nur source/FileZilla.rc source.utf8/FileZilla.rc
old new 955 955 IDC_STATIC,14,156,141,8 956 956 END 957 957 958 IDD_SITEMANAGER_ADVANCED DIALOGEX 0, 0, 240, 1 77958 IDD_SITEMANAGER_ADVANCED DIALOGEX 0, 0, 240, 193 959 959 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 960 960 CAPTION "Advanced Site settings" 961 961 FONT 8, "MS Shell Dlg", 0, 0, 0x1 … … 977 977 UDS_ARROWKEYS | UDS_NOTHOUSANDS,103,127,11,14 978 978 LTEXT "Adjust remote file time by",IDC_STATIC,7,131,78,8 979 979 LTEXT "hours",IDC_STATIC,119,131,18,8 980 PUSHBUTTON "OK",IDOK,55,1 56,50,14981 PUSHBUTTON "Cancel",IDCANCEL,135,1 56,50,14980 PUSHBUTTON "OK",IDOK,55,172,50,14 981 PUSHBUTTON "Cancel",IDCANCEL,135,172,50,14 982 982 LTEXT "Default &local directory:",IDC_STATIC,7,28,71,8 983 983 EDITTEXT IDC_LOCALDIR,7,36,142,14,ES_AUTOHSCROLL 984 984 PUSHBUTTON "...",IDC_SITEMANAGER_LOCALDIR_BROWSE,153,36,12,14 … … 991 991 LTEXT "Default remote d&irectory:",IDC_STATIC,7,58,78,8 992 992 EDITTEXT IDC_REMOTEDIR,7,66,157,14,ES_AUTOHSCROLL, 993 993 WS_EX_TRANSPARENT 994 CONTROL "Use UTF-&8 for remote",IDC_CHECK_USEUTF8,"Button", 995 BS_AUTOCHECKBOX | WS_TABSTOP,7,153,85,10 994 996 END 995 997 996 998 IDD_OPTIONS_PANELAYOUT DIALOGEX 0, 0, 286, 217 -
FtpControlSocket.cpp
diff -Nur source/FtpControlSocket.cpp source.utf8/FtpControlSocket.cpp
old new 242 242 filename = "cacert.pem"; 243 243 } 244 244 245 m_bUTF8 = server.bUTF8; 246 245 247 if (!server.fwbypass) 246 248 { 247 249 int nProxyType = COptions::GetOptionVal(OPTION_PROXYTYPE); -
FzApiStructures.h
diff -Nur source/FzApiStructures.h source.utf8/FzApiStructures.h
old new 32 32 int port; 33 33 CString user,pass; 34 34 BOOL fwbypass; 35 BOOL bUTF8; 35 36 CString path; 36 37 BOOL bDontRememberPass; 37 38 int nServerType; -
FzSFtp/PSFTP.C
diff -Nur source/FzSFtp/PSFTP.C source.utf8/FzSFtp/PSFTP.C
old new 17 17 #include "int64.h" 18 18 19 19 #include "FzSFtpIpc.h" 20 #include <tchar.h> 20 21 21 22 /* 22 23 * Since SFTP is a request-response oriented protocol, it requires … … 389 390 sfree(fname); 390 391 return 0; 391 392 } 392 393 #ifdef _UNICODE 394 { 395 int len; 396 397 // convert from UTF-8 to ANSI 398 len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)outfname, -1, NULL, 0); 399 if (len != 0) 400 { 401 wchar_t *p1; 402 403 p1 = malloc(sizeof(wchar_t) * (len*2+1)); 404 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)outfname, -1 , (LPWSTR)p1, len*2); 405 if (restart) 406 fp = CreateFile(p1, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 407 else 408 fp = CreateFile(p1, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); 409 free(p1); 410 } 411 else { 412 if (restart) 413 fp = CreateFileA(outfname, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 414 else 415 fp = CreateFileA(outfname, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); 416 } 417 } 418 #else 393 419 if (restart) 394 420 fp = CreateFileA(outfname, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 395 421 else 396 422 fp = CreateFileA(outfname, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0); 397 423 #endif 398 424 if (fp==INVALID_HANDLE_VALUE) 399 425 { 400 426 FzSFtpIpc_Error1("Unable to open %s", outfname); … … 508 534 return 0; 509 535 } 510 536 537 #ifdef _UNICODE 538 { 539 int len; 540 541 // convert from UTF-8 to ANSI 542 len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)localfile, -1, NULL, 0); 543 if (len != 0) 544 { 545 wchar_t *p1; 546 547 p1 = malloc(sizeof(wchar_t) * (len*2+1)); 548 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)localfile, -1 , (LPWSTR)p1, len*2); 549 fp = CreateFile(p1, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 550 free(p1); 551 } 552 else { 553 fp = CreateFileA(localfile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 554 } 555 } 556 #else 511 557 fp = CreateFileA(localfile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); 558 #endif 512 559 if (fp == INVALID_HANDLE_VALUE) 513 560 { 514 561 FzSFtpIpc_Error1("Unable to open %s", localfile); -
MainFrm.cpp
diff -Nur source/MainFrm.cpp source.utf8/MainFrm.cpp
old new 3998 3998 server.path=site.RemoteDir; 3999 3999 server.fwbypass=site.bFirewallBypass; 4000 4000 server.bDontRememberPass=site.bPassDontSave; 4001 server.bUTF8 = site.bUTF8; 4001 4002 server.name = site.name; 4002 4003 server.nPasv = site.nPasv; 4003 4004 server.nTimeZoneOffset = site.nTimeZoneOffset * 60 + site.nTimeZoneOffset2; … … 4414 4415 server.port=_ttoi(m_Port); 4415 4416 server.path=path; 4416 4417 server.fwbypass=bBypass; 4418 server.bUTF8=FALSE; 4417 4419 server.bDontRememberPass=FALSE; 4418 4420 m_pCommandQueue->Connect(server); 4419 4421 if (path!="") -
Options.cpp
diff -Nur source/Options.cpp source.utf8/Options.cpp
old new 507 507 _T("Switch view locations"), 1, _T("Use MODE Z "), 1, 508 508 _T("MODE Z level"), 1, _T("Transfer IP v6"), 0, 509 509 _T("Enable IPv6"), 1, _T("Log Timestamps"), 1, 510 _T("VMS display all revisions"), 1 510 _T("VMS display all revisions"), 1, _T("Last Server UseUTF8"), 1 511 511 }; 512 512 513 513 void COptions::SetOption(int nOptionID,int value) -
Options.h
diff -Nur source/Options.h source.utf8/Options.h
old new 52 52 53 53 #include "misc\MarkupSTL.h" 54 54 55 #define OPTIONS_NUM 11 555 #define OPTIONS_NUM 116 56 56 57 57 ///////////////////////////////////////////////////////////////////////////// 58 58 // Dialogfeld COptions … … 280 280 #define OPTION_ENABLE_IPV6 113 281 281 #define OPTION_LOGTIMESTAMPS 114 282 282 #define OPTION_VMSALLREVISIONS 115 283 #define OPTION_LASTSERVERUSEUTF8 116 283 284 284 285 //{{AFX_INSERT_LOCATION}} 285 286 // Microsoft Visual C++ fügt unmittelbar vor der vorhergehenden Zeile zusätzliche Deklarationen ein. -
SFtpIpc.cpp
diff -Nur source/SFtpIpc.cpp source.utf8/SFtpIpc.cpp
old new 146 146 147 147 m_hReceiveThread=0; 148 148 m_hExitEvent=0; 149 m_bUTF8 = pOwner->m_bUTF8; 149 150 } 150 151 151 152 CSFtpIpc::~CSFtpIpc() … … 417 418 BOOL CSFtpIpc::Send(const DWORD &nID, LPCTSTR str) 418 419 { 419 420 USES_CONVERSION; 420 if (str) 421 return Send(nID, (const DWORD)strlen(T2CA(str))+1, (LPVOID)T2CA(str)); 421 422 if (str) { 423 if (m_bUTF8) 424 { 425 bool res; 426 LPCWSTR unicode = T2CW(str); 427 int len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, 0, 0, 0, 0); 428 char* utf8 = new char[len + 1]; 429 WideCharToMultiByte(CP_UTF8, 0, unicode, -1, utf8, len + 1, 0, 0); 430 431 res = Send(nID, (const DWORD)strlen(utf8)+1, (LPVOID)utf8); 432 delete [] utf8; 433 return res; 434 } 435 else 436 { 437 return Send(nID, (const DWORD)strlen(T2CA(str))+1, (LPVOID)T2CA(str)); 438 } 439 } 422 440 else 423 441 return Send(nID, 0, 0); 424 442 } -
SFtpIpc.h
diff -Nur source/SFtpIpc.h source.utf8/SFtpIpc.h
old new 64 64 HANDLE m_hReceiveThread; 65 65 static DWORD WINAPI ReceiveThread( LPVOID pParam ); 66 66 HANDLE m_hExitEvent; 67 bool m_bUTF8; 67 68 }; 68 69 69 70 #endif // !defined(AFX_SFTPIPC_H__71B20B86_C3D8_4197_90C2_349A18548D58__INCLUDED_) -
SftpControlSocket.cpp
diff -Nur source/SftpControlSocket.cpp source.utf8/SftpControlSocket.cpp
old new 39 39 class CSFtpControlSocket::CFileTransferData : public CSFtpControlSocket::t_operation::COpData 40 40 { 41 41 public: 42 CFileTransferData(t_server server )42 CFileTransferData(t_server server, bool bUTF8) 43 43 { 44 44 pDirectoryListing=0; 45 45 nWaitNextOpState=0; … … 50 50 transferdata.nTransferStart=0; 51 51 pStartTime=0; 52 52 bUseAbsolutePaths = FALSE; 53 pParser = new CFtpListResult(server );53 pParser = new CFtpListResult(server, bUTF8); 54 54 }; 55 55 virtual ~CFileTransferData() 56 56 { … … 79 79 class CSFtpControlSocket::CListData:public CSFtpControlSocket::t_operation::COpData 80 80 { 81 81 public: 82 CListData(t_server server )82 CListData(t_server server, bool bUTF8) 83 83 { 84 84 pDirectoryListing=0; 85 pParser = new CFtpListResult(server );85 pParser = new CFtpListResult(server, bUTF8); 86 86 } 87 87 virtual ~CListData() 88 88 { … … 124 124 m_bQuit=FALSE; 125 125 m_bCheckForTimeout=TRUE; 126 126 m_bError=FALSE; 127 m_bUTF8 = false; 127 128 } 128 129 129 130 CSFtpControlSocket::~CSFtpControlSocket() … … 154 155 ASSERT(!m_Operation.nOpMode); 155 156 156 157 ASSERT(!m_pProxyLayer); 158 159 m_bUTF8 = server.bUTF8; 157 160 158 161 if (!server.fwbypass) 159 162 { … … 326 329 if (m_Operation.nOpState==LIST_PWD) 327 330 { //Reply to PWD command 328 331 pData->realpath.SetServer(m_CurrentServer); 329 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 330 { 331 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 332 ResetOperation(FZ_REPLY_ERROR); 333 return; 332 if (m_bUTF8) { 333 USES_CONVERSION; 334 335 // convert from UTF-8 to ANSI 336 int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1, NULL, 0); 337 if (len != 0) 338 { 339 LPWSTR p1 = new WCHAR[len + 1]; 340 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1 , (LPWSTR)p1, len*2); 341 CString tempstr = W2CT(p1); 342 delete [] p1; 343 if (tempstr=="" || !pData->realpath.SetPath(tempstr)) 344 { 345 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 346 ResetOperation(FZ_REPLY_ERROR); 347 return; 348 } 349 pData->rawpwd=tempstr; 350 } 351 else 352 { 353 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 354 ResetOperation(FZ_REPLY_ERROR); 355 return; 356 } 357 } 358 else { 359 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 360 { 361 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 362 ResetOperation(FZ_REPLY_ERROR); 363 return; 364 } 365 pData->rawpwd=m_Reply; 334 366 } 335 pData->rawpwd=m_Reply;336 367 m_pOwner->SetCurrentPath(pData->realpath); 337 368 if (pData->nListMode&FZ_LIST_USECACHE) 338 369 { … … 363 394 else if (m_Operation.nOpState==LIST_CWD) 364 395 { 365 396 pData->realpath.SetServer(m_CurrentServer); 366 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 367 { 368 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 369 ResetOperation(FZ_REPLY_ERROR); 370 return; 397 if (m_bUTF8) { 398 USES_CONVERSION; 399 400 // convert from UTF-8 to ANSI 401 int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1, NULL, 0); 402 if (len != 0) 403 { 404 LPWSTR p1 = new WCHAR[len + 1]; 405 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1 , (LPWSTR)p1, len*2); 406 CString tempstr = W2CT(p1); 407 delete [] p1; 408 if (tempstr=="" || !pData->realpath.SetPath(tempstr)) 409 { 410 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 411 ResetOperation(FZ_REPLY_ERROR); 412 return; 413 } 414 pData->rawpwd=tempstr; 415 } 416 else 417 { 418 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 419 ResetOperation(FZ_REPLY_ERROR); 420 return; 421 } 422 } 423 else { 424 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 425 { 426 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 427 ResetOperation(FZ_REPLY_ERROR); 428 return; 429 } 430 pData->rawpwd=m_Reply; 371 431 } 372 pData->rawpwd=m_Reply;373 432 m_pOwner->SetCurrentPath(pData->realpath); 374 433 if (pData->nListMode&FZ_LIST_USECACHE && pData->subdir=="") 375 434 { … … 410 469 else if (m_Operation.nOpState==LIST_CWD2) 411 470 { 412 471 pData->realpath.SetServer(m_CurrentServer); 413 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 414 { 415 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 416 ResetOperation(FZ_REPLY_ERROR); 417 return; 472 if (m_bUTF8) { 473 USES_CONVERSION; 474 475 // convert from UTF-8 to ANSI 476 int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1, NULL, 0); 477 if (len != 0) 478 { 479 LPWSTR p1 = new WCHAR[len + 1]; 480 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1 , (LPWSTR)p1, len*2); 481 CString tempstr = W2CT(p1); 482 delete [] p1; 483 if (tempstr=="" || !pData->realpath.SetPath(tempstr)) 484 { 485 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 486 ResetOperation(FZ_REPLY_ERROR); 487 return; 488 } 489 pData->rawpwd=tempstr; 490 } 491 else 492 { 493 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 494 ResetOperation(FZ_REPLY_ERROR); 495 return; 496 } 497 } 498 else { 499 if (m_Reply=="" || !pData->realpath.SetPath(A2CT(m_Reply))) 500 { 501 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path") ); 502 ResetOperation(FZ_REPLY_ERROR); 503 return; 504 } 505 pData->rawpwd=m_Reply; 418 506 } 419 pData->rawpwd=m_Reply;420 507 m_pOwner->SetCurrentPath(pData->realpath); 421 508 if (pData->nListMode&FZ_LIST_USECACHE) 422 509 { … … 512 599 513 600 if (m_Operation.nOpState==LIST_INIT) 514 601 { //Initialize some variables 515 pData = new CListData(m_CurrentServer );;602 pData = new CListData(m_CurrentServer, m_bUTF8); 516 603 pData->nListMode=nListMode; 517 604 pData->path=path; 518 605 pData->subdir=subdir; … … 691 778 692 779 m_Operation.nOpMode=CSMODE_TRANSFER|(transferfile->get?CSMODE_DOWNLOAD:CSMODE_UPLOAD); 693 780 694 pData = new CFileTransferData(m_CurrentServer );781 pData = new CFileTransferData(m_CurrentServer, m_bUTF8); 695 782 m_Operation.pData=pData; 696 783 697 784 //Replace invalid characters in the local filename … … 821 908 { 822 909 CServerPath path; 823 910 path.SetServer(m_CurrentServer); 824 if (!path.SetPath(A2CT(m_Reply))) 911 CString tempstr; 912 if (m_bUTF8) { 913 USES_CONVERSION; 914 915 // convert from UTF-8 to ANSI 916 int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1, NULL, 0); 917 if (len != 0) 918 { 919 LPWSTR p1 = new WCHAR[len + 1]; 920 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1 , (LPWSTR)p1, len*2); 921 tempstr = W2CT(p1); 922 delete [] p1; 923 } 924 else 925 { 926 tempstr = ""; 927 } 928 } 929 else { 930 tempstr = A2CT(m_Reply); 931 } 932 if (!path.SetPath(tempstr)) 825 933 { 826 934 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path")); 827 935 nReplyError=FZ_REPLY_ERROR; 828 936 } 829 937 else 830 938 { 831 pData->rawpwd= m_Reply;939 pData->rawpwd=tempstr; 832 940 m_pOwner->SetCurrentPath(path); 833 941 if (path!=pData->transferfile.remotepath) 834 942 nReplyError=FZ_REPLY_ERROR | FZ_REPLY_CRITICALERROR; … … 1046 1154 { 1047 1155 CServerPath path; 1048 1156 path.SetServer(m_CurrentServer); 1049 if (!path.SetPath(A2CT(m_Reply))) 1157 CString tempstr; 1158 if (m_bUTF8) { 1159 USES_CONVERSION; 1160 1161 // convert from UTF-8 to ANSI 1162 int len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1, NULL, 0); 1163 if (len != 0) 1164 { 1165 LPWSTR p1 = new WCHAR[len + 1]; 1166 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)m_Reply, -1 , (LPWSTR)p1, len*2); 1167 tempstr = W2CT(p1); 1168 delete [] p1; 1169 } 1170 else 1171 { 1172 tempstr = ""; 1173 } 1174 } 1175 else { 1176 tempstr = A2CT(m_Reply); 1177 } 1178 if (!path.SetPath(tempstr)) 1050 1179 { 1051 1180 LogMessage(__FILE__, __LINE__, this,FZ_LOG_WARNING, _T("Can't parse path")); 1052 1181 nReplyError=FZ_REPLY_ERROR; 1053 1182 } 1054 1183 else 1055 1184 { 1056 pData->rawpwd= m_Reply;1185 pData->rawpwd=tempstr; 1057 1186 m_pOwner->SetCurrentPath(path); 1058 1187 if (path!=pData->transferfile.remotepath) 1059 1188 nReplyError=FZ_REPLY_ERROR | FZ_REPLY_CRITICALERROR; … … 1336 1465 filename = pData->transferfile.remotefile; 1337 1466 else 1338 1467 filename = pData->transferfile.remotepath.GetPath() + pData->transferfile.remotefile; 1339 int nLen1=strlen(T2CA(filename)) + 1; 1340 int nLen2=strlen(T2CA(pData->transferfile.localfile))+1; 1341 char *pCmd=new char[nLen1+nLen2+4]; 1342 strcpy(pCmd, T2CA(filename)); 1343 strcpy(pCmd+nLen1, T2CA(pData->transferfile.localfile)); 1344 memcpy(pCmd+nLen1+nLen2, &pData->transferdata.bResume, 4); 1468 char *pCmd; 1469 int nLen1; 1470 int nLen2; 1471 if (m_bUTF8) { 1472 #ifdef _UNICODE 1473 LPCWSTR unicode_remote = T2CW(filename); 1474 int len = WideCharToMultiByte(CP_UTF8, 0, unicode_remote, -1, 0, 0, 0, 0); 1475 char* utf8_remote = new char[len + 1]; 1476 WideCharToMultiByte(CP_UTF8, 0, unicode_remote, -1, utf8_remote, len + 1, 0, 0); 1477 LPCWSTR unicode_local = T2CW(pData->transferfile.localfile); 1478 len = WideCharToMultiByte(CP_UTF8, 0, unicode_local, -1, 0, 0, 0, 0); 1479 char* utf8_local = new char[len + 1]; 1480 WideCharToMultiByte(CP_UTF8, 0, unicode_local, -1, utf8_local, len + 1, 0, 0); 1481 nLen1=strlen(utf8_remote) + 1; 1482 nLen2=strlen(utf8_local)+1; 1483 pCmd=new char[nLen1+nLen2+4]; 1484 strcpy(pCmd, utf8_remote); 1485 delete [] utf8_remote; 1486 strcpy(pCmd+nLen1, utf8_local); 1487 delete [] utf8_local; 1488 memcpy(pCmd+nLen1+nLen2, &pData->transferdata.bResume, 4); 1489 #else 1490 LPCWSTR unicode_remote = T2CW(filename); 1491 int len = WideCharToMultiByte(CP_UTF8, 0, unicode_remote, -1, 0, 0, 0, 0); 1492 char* utf8_remote = new char[len + 1]; 1493 WideCharToMultiByte(CP_UTF8, 0, unicode_remote, -1, utf8_remote, len + 1, 0, 0); 1494 nLen1=strlen(utf8_remote) + 1; 1495 nLen2=strlen(T2CA(pData->transferfile.localfile))+1; 1496 pCmd=new char[nLen1+nLen2+4]; 1497 strcpy(pCmd, utf8_remote); 1498 delete [] utf8_remote; 1499 strcpy(pCmd+nLen1, T2CA(pData->transferfile.localfile)); 1500 memcpy(pCmd+nLen1+nLen2, &pData->transferdata.bResume, 4); 1501 #endif 1502 } 1503 else { 1504 #ifdef _UNICODE 1505 LPCWSTR unicode_local = T2CW(pData->transferfile.localfile); 1506 int len = WideCharToMultiByte(CP_UTF8, 0, unicode_local, -1, 0, 0, 0, 0); 1507 char* utf8_local = new char[len + 1]; 1508 WideCharToMultiByte(CP_UTF8, 0, unicode_local, -1, utf8_local, len + 1, 0, 0); 1509 nLen1=strlen(T2CA(filename)) + 1; 1510 nLen2=strlen(utf8_local)+1; 1511 pCmd=new char[nLen1+nLen2+4]; 1512 strcpy(pCmd, T2CA(filename)); 1513 strcpy(pCmd+nLen1, utf8_local); 1514 delete [] utf8_local; 1515 memcpy(pCmd+nLen1+nLen2, &pData->transferdata.bResume, 4); 1516 #else 1517 nLen1=strlen(T2CA(filename)) + 1; 1518 nLen2=strlen(T2CA(pData->transferfile.localfile))+1; 1519 pCmd=new char[nLen1+nLen2+4]; 1520 strcpy(pCmd, T2CA(filename)); 1521 strcpy(pCmd+nLen1, T2CA(pData->transferfile.localfile)); 1522 memcpy(pCmd+nLen1+nLen2, &pData->transferdata.bResume, 4); 1523 #endif 1524 } 1345 1525 pData->pStartTime = new CTime; 1346 1526 *pData->pStartTime = CTime::GetCurrentTime(); 1347 1527 if (pData->transferfile.get) … … 1508 1688 char *pData; 1509 1689 if (newPath.IsEmpty()) 1510 1690 { 1511 nLen = _tcslen( path.GetPath() + oldName + path.GetPath() + newName) + 2; 1512 pData = new char[nLen]; 1513 strcpy(pData, T2CA(path.GetPath() + oldName)); 1514 strcpy(pData + _tcslen(path.GetPath() + oldName) + 1, T2CA(path.GetPath() + newName)); 1691 if (m_bUTF8) { 1692 LPCWSTR uni_oldname = T2CW(path.GetPath() + oldName); 1693 int len = WideCharToMultiByte(CP_UTF8, 0, uni_oldname, -1, 0, 0, 0, 0); 1694 char* utf8_oldname = new char[len + 1]; 1695 WideCharToMultiByte(CP_UTF8, 0, uni_oldname, -1, utf8_oldname, len + 1, 0, 0); 1696 LPCWSTR uni_newname = T2CW(path.GetPath() + newName); 1697 len = WideCharToMultiByte(CP_UTF8, 0, uni_newname, -1, 0, 0, 0, 0); 1698 char* utf8_newname = new char[len + 1]; 1699 WideCharToMultiByte(CP_UTF8, 0, uni_newname, -1, utf8_newname, len + 1, 0, 0); 1700 nLen = strlen(utf8_oldname) + strlen(utf8_newname) + 2; 1701 pData = new char[nLen]; 1702 strcpy(pData, utf8_oldname); 1703 strcpy(pData + strlen(utf8_oldname) + 1, utf8_newname); 1704 delete [] utf8_oldname; 1705 delete [] utf8_newname; 1706 } 1707 else { 1708 nLen = _tcslen( path.GetPath() + oldName + path.GetPath() + newName) + 2; 1709 pData = new char[nLen]; 1710 strcpy(pData, T2CA(path.GetPath() + oldName)); 1711 strcpy(pData + _tcslen(path.GetPath() + oldName) + 1, T2CA(path.GetPath() + newName)); 1712 } 1515 1713 } 1516 1714 else 1517 1715 { 1518 nLen = _tcslen( path.GetPath() + oldName + newPath.GetPath() + newName) + 2; 1519 pData = new char[nLen]; 1520 strcpy(pData, T2CA(path.GetPath() + oldName)); 1521 strcpy(pData + _tcslen(path.GetPath() + oldName) + 1, T2CA(newPath.GetPath() + newName)); 1716 if (m_bUTF8) { 1717 LPCWSTR uni_oldname = T2CW(path.GetPath() + oldName); 1718 int len = WideCharToMultiByte(CP_UTF8, 0, uni_oldname, -1, 0, 0, 0, 0); 1719 char* utf8_oldname = new char[len + 1]; 1720 WideCharToMultiByte(CP_UTF8, 0, uni_oldname, -1, utf8_oldname, len + 1, 0, 0); 1721 LPCWSTR uni_newname = T2CW(newPath.GetPath() + newName); 1722 len = WideCharToMultiByte(CP_UTF8, 0, uni_newname, -1, 0, 0, 0, 0); 1723 char* utf8_newname = new char[len + 1]; 1724 WideCharToMultiByte(CP_UTF8, 0, uni_newname, -1, utf8_newname, len + 1, 0, 0); 1725 nLen = strlen(utf8_oldname) + strlen(utf8_newname) + 2; 1726 pData = new char[nLen]; 1727 strcpy(pData, utf8_oldname); 1728 strcpy(pData + strlen(utf8_oldname) + 1, utf8_newname); 1729 delete [] utf8_oldname; 1730 delete [] utf8_newname; 1731 } 1732 else { 1733 nLen = _tcslen( path.GetPath() + oldName + newPath.GetPath() + newName) + 2; 1734 pData = new char[nLen]; 1735 strcpy(pData, T2CA(path.GetPath() + oldName)); 1736 strcpy(pData + _tcslen(path.GetPath() + oldName) + 1, T2CA(newPath.GetPath() + newName)); 1737 } 1522 1738 } 1523 1739 if (!m_pDataChannel->Send(SFTP_DATAID_STC_RENAME, nLen, pData)) 1524 1740 { … … 2921 3137 USES_CONVERSION; 2922 3138 m_Operation.nOpMode=CSMODE_CHMOD; 2923 3139 CString str; 3140 int nLen; 3141 char *pData; 2924 3142 str.Format( _T("%d %s%s"), nValue, path.GetPath(), filename); 2925 int nLen=strlen(T2CA(str))+1; 2926 char *pData=new char[nLen]; 2927 strcpy(pData, T2CA(str)); 2928 int pos(str.Find( _T(" ") )); 2929 ASSERT(pos!=-1); 2930 pData[pos]=0; 3143 if (m_bUTF8) { 3144 USES_CONVERSION; 3145 3146 LPCWSTR unicode = T2CW(str); 3147 int len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, 0, 0, 0, 0); 3148 char* utf8 = new char[len + 1]; 3149 WideCharToMultiByte(CP_UTF8, 0, unicode, -1, utf8, len + 1, 0, 0); 3150 nLen=strlen(utf8)+1; 3151 pData=new char[nLen]; 3152 strcpy(pData, utf8); 3153 int pos(str.Find( _T(" ") )); 3154 ASSERT(pos!=-1); 3155 pData[pos]=0; 3156 } 3157 else { 3158 nLen=strlen(T2CA(str))+1; 3159 pData=new char[nLen]; 3160 strcpy(pData, T2CA(str)); 3161 int pos(str.Find( _T(" ") )); 3162 ASSERT(pos!=-1); 3163 pData[pos]=0; 3164 } 2931 3165 if (!m_pDataChannel->Send(SFTP_DATAID_STC_CHMOD, nLen, pData)) 2932 3166 DoClose(); 2933 3167 delete [] pData; -
SftpControlSocket.h
diff -Nur source/SftpControlSocket.h source.utf8/SftpControlSocket.h
old new 37 37 class CSFtpControlSocket : public CControlSocket 38 38 { 39 39 public: 40 bool m_bUTF8; 40 41 BOOL m_bError; 41 42 void OnClientError(int nErrorCode); 42 43 int OnClientRequest(int nId, int &nDataLength, LPVOID pData); -
SiteManager.cpp
diff -Nur source/SiteManager.cpp source.utf8/SiteManager.cpp
old new 646 646 site->nLogonType = _ttoi(GetKey(hRootKey, Name, "Logontype"))-1; 647 647 site->RemoteDir = GetKey(hRootKey, Name, "Remote Dir"); 648 648 site->LocalDir = GetKey(hRootKey, Name, "Local Dir"); 649 site->bUTF8 = _ttoi(GetKey(hRootKey, Name, "Use UTF8")); 649 650 site->bFirewallBypass = _ttoi(GetKey(hRootKey, Name, "FW Bypass")); 650 651 site->bPassDontSave = _ttoi(GetKey(hRootKey, Name, "Dont Save Pass")); 651 652 site->nServerType = _ttoi(GetKey(hRootKey, Name, "Server Type")); … … 676 677 site->nLogonType = _ttoi(pMarkup->GetChildAttrib( _T("Logontype") )); 677 678 site->RemoteDir = pMarkup->GetChildAttrib( _T("RemoteDir") ); 678 679 site->LocalDir = pMarkup->GetChildAttrib( _T("LocalDir") ); 680 site->bUTF8 = _ttoi(pMarkup->GetChildAttrib( _T("UseUTF8") )); 679 681 site->bFirewallBypass = _ttoi(pMarkup->GetChildAttrib( _T("FWBypass") )); 680 682 site->bPassDontSave = _ttoi(pMarkup->GetChildAttrib( _T("DontSavePass") )); 681 683 site->nServerType = _ttoi(pMarkup->GetChildAttrib( _T("ServerType") )); … … 1379 1381 startsWith(str, _T("Default remote dir: ")) || 1380 1382 startsWith(str, _T("Default remote folder: "))) 1381 1383 pSite->RemoteDir = str; 1384 else if (startsWith(str, _T("Use UTF8: "))) 1385 pSite->bUTF8 = _ttoi(str); 1382 1386 else if (startsWith(str, _T("Firewall Bypass: "))) 1383 1387 pSite->bFirewallBypass = _ttoi(str); 1384 1388 else if (startsWith(str, _T("Dont Save Pass: "))) … … 1694 1698 SetKey(name, _T("Pass"), _T("")); 1695 1699 else 1696 1700 SetKey(name, "Pass", CCrypt::encrypt(site->Pass)); 1701 str=site->bUTF8?"1":"0"; 1702 SetKey(name,"Use UTF8",str); 1697 1703 str.Format(_T("%d"), site->nLogonType+1); 1698 1704 SetKey(name,"Logontype",str); 1699 1705 str=site->bFirewallBypass?"1":"0"; … … 1718 1724 pMarkup->AddChildAttrib( _T("User"), site->User); 1719 1725 pMarkup->AddChildAttrib( _T("RemoteDir"), site->RemoteDir); 1720 1726 pMarkup->AddChildAttrib( _T("LocalDir"), site->LocalDir); 1727 pMarkup->AddChildAttrib( _T("UseUTF8"), site->bUTF8); 1721 1728 if (_ttoi(COptions::GetOption(OPTION_RUNINSECUREMODE)) || site->bPassDontSave) 1722 1729 pMarkup->AddChildAttrib( _T("Pass"), _T("")); 1723 1730 else -
SiteManager.h
diff -Nur source/SiteManager.h source.utf8/SiteManager.h
old new 42 42 CString Pass; 43 43 CString RemoteDir; 44 44 CString LocalDir; 45 BOOL bUTF8; 45 46 int nLogonType; 46 47 BOOL bFirewallBypass; 47 48 BOOL bPassDontSave; -
SiteManagerAdvancedDlg.cpp
diff -Nur source/SiteManagerAdvancedDlg.cpp source.utf8/SiteManagerAdvancedDlg.cpp
old new 28 28 m_nPassive = -1; 29 29 m_LocalDir = _T(""); 30 30 m_RemoteDir = _T(""); 31 m_bUTF8 = false; 31 32 //}}AFX_DATA_INIT 32 33 } 33 34 … … 45 46 DDX_Radio(pDX, IDC_SITEMANAGER_ADVANCED_PASSIVE1, m_nPassive); 46 47 DDX_Text(pDX, IDC_LOCALDIR, m_LocalDir); 47 48 DDX_Text(pDX, IDC_REMOTEDIR, m_RemoteDir); 49 DDX_Check(pDX, IDC_CHECK_USEUTF8, m_bUTF8); 48 50 //}}AFX_DATA_MAP 49 51 } 50 52 … … 80 82 81 83 m_LocalDir = m_pSiteManagerItem->LocalDir; 82 84 m_RemoteDir = m_pSiteManagerItem->RemoteDir; 85 m_bUTF8 = m_pSiteManagerItem->bUTF8; 83 86 84 87 UpdateData(FALSE); 85 88 … … 105 108 m_RemoteDir = path.GetPath(); 106 109 } 107 110 111 m_pSiteManagerItem->bUTF8 = m_bUTF8; 108 112 m_pSiteManagerItem->LocalDir = m_LocalDir; 109 113 m_pSiteManagerItem->RemoteDir = m_RemoteDir; 110 114 m_pSiteManagerItem->nPasv = m_nPassive; -
SiteManagerAdvancedDlg.h
diff -Nur source/SiteManagerAdvancedDlg.h source.utf8/SiteManagerAdvancedDlg.h
old new 29 29 int m_nPassive; 30 30 CString m_LocalDir; 31 31 CString m_RemoteDir; 32 BOOL m_bUTF8; 32 33 //}}AFX_DATA 33 34 34 35 -
resource.h
diff -Nur source/resource.h source.utf8/resource.h
old new 349 349 #define IDC_OPTIONS_TRANSFER_COMPRESSION_LEVEL 1284 350 350 #define IDC_OPTIONS_TRANSFER_COMPRESSION_FILETYPES 1285 351 351 #define IDC_OPTIONS_CONNECTION2_ENABLEIPV6 1287 352 #define IDC_CHECK_USEUTF8 1288 352 353 #define IDS_STATUSMSG_CONNECTED 2000 353 354 #define IDS_STATUSMSG_CONNECTEDWITH 2001 354 355 #define IDS_STATUSMSG_CONNECTEDWITHSFTP 2002 … … 756 757 #define _APS_3D_CONTROLS 1 757 758 #define _APS_NEXT_RESOURCE_VALUE 3105 758 759 #define _APS_NEXT_COMMAND_VALUE 32902 759 #define _APS_NEXT_CONTROL_VALUE 128 8760 #define _APS_NEXT_CONTROL_VALUE 1289 760 761 #define _APS_NEXT_SYMED_VALUE 3205 761 762 #endif 762 763 #endif