Can't download files with Arabic name with Java FTP client

osfar :

I have Java code that connects to an FTP server and downloads files. If the file name contains Arabic letters, then it always fails to download. But if it's English, it downloads successfully.

This is my code.
If the path is like this then it fails to download:

String actualFileLocation =
    "/RelatedDocumentUploads\\...\\2017-S2\\تقرير الربع الرابع تقرير 2017 (006)senton(18-01-2017).pdf" ;

But if it's like the following it works fine:

String actualFileLocation =
    "/RelatedDocumentUploads\\...\\2017-S2\\RCJY O5.K2 -D6(Q4) 2017-Doc 1.JPG" ;

The rest of the code:

int index = actualFileLocation.lastIndexOf("\\");
int extIndex = actualFileLocation.lastIndexOf(".");
String fileName = actualFileLocation.substring(index + 1, extIndex);
String extensn = actualFileLocation.substring(extIndex, actualFileLocation.length());
File parent = new File(System.getProperty("java.io.tmpdir"));
File tempFile = new File(parent, fileName + extensn);
tempFile.createNewFile();
OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(tempFile));
boolean success = ftpClient.retrieveFile(actualFileLocation, outputStream);

FTP client is from type : public class org.apache.commons.net.ftp.FTPClient

What's is wrong with my code?

This is the output of the of the log:

PASV
227 Entering Passive Mode (10,110,103,31,215,6)
RETR /RelatedDocumentUploads\Entities\RCJY\KPI\Documents\RCJY.O5.K2\Supporting Document\2017-S2\تقرير الربع الرابع تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf
550 File not found

And this is the log from WinSCP client, which downloads the file successfully:

. 2019-03-04 17:47:22.289 --------------------------------------------------------------------------
. 2019-03-04 17:47:22.290 WinSCP Version 5.13.7 (Build 9125) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2019-03-04 17:47:22.290 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2019-03-04 17:47:22.290 Log level: Normal
. 2019-03-04 17:47:22.290 Local account: MyPC-EG\PCHome
. 2019-03-04 17:47:22.290 Working directory: C:\Program Files (x86)\WinSCP
. 2019-03-04 17:47:22.290 Process ID: 13160
. 2019-03-04 17:47:22.291 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2019-03-04 17:47:22.291 Time zone: Current: GMT+2 (Egypt Standard Time), No DST
. 2019-03-04 17:47:22.291 Login time: Monday, March 04, 2019 5:47:22 PM
. 2019-03-04 17:47:22.291 --------------------------------------------------------------------------
. 2019-03-04 17:47:22.291 Session name: [email protected] (Ad-Hoc site)
. 2019-03-04 17:47:22.291 Host name: 10.110.111.111 (Port: 21)
. 2019-03-04 17:47:22.291 User name: user (Password: No, Key file: No, Passphrase: No)
. 2019-03-04 17:47:22.291 Transfer Protocol: FTP
. 2019-03-04 17:47:22.291 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2019-03-04 17:47:22.292 Disable Nagle: No
. 2019-03-04 17:47:22.292 Proxy: None
. 2019-03-04 17:47:22.292 Send buffer: 262144
. 2019-03-04 17:47:22.292 UTF: Auto
. 2019-03-04 17:47:22.292 FTPS: None [Client certificate: No]
. 2019-03-04 17:47:22.292 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2019-03-04 17:47:22.292 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2019-03-04 17:47:22.292 Cache directory changes: Yes, Permanent: Yes
. 2019-03-04 17:47:22.292 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2019-03-04 17:47:22.292 Timezone offset: 0h 0m
. 2019-03-04 17:47:22.292 --------------------------------------------------------------------------
. 2019-03-04 17:47:22.354 Connecting to 10.110.103.31 ...
. 2019-03-04 17:47:22.804 Connected with 10.110.103.31. Waiting for welcome message...
< 2019-03-04 17:47:23.286 220-FileZilla Server 0.9.60 beta
< 2019-03-04 17:47:23.286 220-
< 2019-03-04 17:47:23.286 220 EMP FTP
> 2019-03-04 17:47:23.286 USER user
< 2019-03-04 17:47:23.780 331 Password required for user
> 2019-03-04 17:47:29.603 PASS **********
< 2019-03-04 17:47:30.092 230 Logged on
> 2019-03-04 17:47:30.093 SYST
< 2019-03-04 17:47:30.585 215 UNIX emulated by FileZilla
> 2019-03-04 17:47:30.585 FEAT
< 2019-03-04 17:47:31.078 211-Features:
< 2019-03-04 17:47:31.078  MDTM
< 2019-03-04 17:47:31.078  REST STREAM
< 2019-03-04 17:47:31.078  SIZE
< 2019-03-04 17:47:31.078  MLST type*;size*;modify*;
< 2019-03-04 17:47:31.078  MLSD
< 2019-03-04 17:47:31.078  UTF8
< 2019-03-04 17:47:31.078  CLNT
< 2019-03-04 17:47:31.078  MFMT
< 2019-03-04 17:47:31.078  EPSV
< 2019-03-04 17:47:31.078  EPRT
< 2019-03-04 17:47:31.079 211 End
> 2019-03-04 17:47:31.088 CLNT WinSCP-release-5.13.7
< 2019-03-04 17:47:31.578 200 Don't care
> 2019-03-04 17:47:31.578 OPTS UTF8 ON
< 2019-03-04 17:47:32.067 202 UTF8 mode is always enabled. No need to send this command.
. 2019-03-04 17:47:32.090 Connected
. 2019-03-04 17:47:32.090 --------------------------------------------------------------------------
. 2019-03-04 17:47:32.091 Using FTP protocol.
. 2019-03-04 17:47:32.091 Doing startup conversation with host.
> 2019-03-04 17:47:32.107 PWD
< 2019-03-04 17:47:32.601 257 "/" is current directory.
. 2019-03-04 17:47:32.601 Getting current directory name.
. 2019-03-04 17:47:32.629 Retrieving directory listing...
> 2019-03-04 17:47:32.629 TYPE A
< 2019-03-04 17:47:33.120 200 Type set to A
> 2019-03-04 17:47:33.121 PASV
< 2019-03-04 17:47:33.588 227 Entering Passive Mode (10,110,103,31,193,94)
> 2019-03-04 17:47:33.589 MLSD
. 2019-03-04 17:47:33.589 Connecting to 10.110.111.111:49502 ...
< 2019-03-04 17:47:34.544 150 Opening data channel for directory listing of "/"
. 2019-03-04 17:47:34.545 Data connection closed
. 2019-03-04 17:47:34.546 type=dir;modify=20190224133717; RelatedDocumentUploads
. 2019-03-04 17:47:34.546 type=dir;modify=20190217090137; RelatedDocumentUploads_UAT
< 2019-03-04 17:47:34.555 226 Successfully transferred "/"
. 2019-03-04 17:47:34.555 Directory listing successful
. 2019-03-04 17:47:34.556 ..;D;0;1899-12-30T02:00:00.000Z;0;"" [0];"" [0];---------;0
. 2019-03-04 17:47:34.556 RelatedDocumentUploads;D;0;2019-02-24T13:37:17.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:34.556 RelatedDocumentUploads_UAT;D;0;2019-02-17T09:01:37.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:34.594 Startup conversation with host finished.
. 2019-03-04 17:47:53.904 Changing directory to "/RelatedDocumentUploads\aaaa\bbbb\cccc\dddd\RCJY.O5.K2\Supporting Document\".
> 2019-03-04 17:47:53.912 CWD /RelatedDocumentUploads\aaaa\bbbb\cccc\dddd\RCJY.O5.K2\Supporting Document\
< 2019-03-04 17:47:54.398 250 CWD successful. "/RelatedDocumentUploads\aaaa\bbbb\cccc\ddddRCJY.O5.K2/Supporting Document" is current directory.
. 2019-03-04 17:47:54.399 Getting current directory name.
> 2019-03-04 17:47:54.399 PWD
< 2019-03-04 17:47:54.893 257 "/RelatedDocumentUploads\aaaa\bbbb\cccc\dddd\RCJY.O5.K2/Supporting Document" is current directory.
. 2019-03-04 17:47:54.894 Retrieving directory listing...
> 2019-03-04 17:47:54.894 TYPE A
< 2019-03-04 17:47:55.383 200 Type set to A
> 2019-03-04 17:47:55.384 PASV
< 2019-03-04 17:47:55.878 227 Entering Passive Mode (10,110,103,31,194,79)
> 2019-03-04 17:47:55.878 MLSD
. 2019-03-04 17:47:55.878 Connecting to 10.111.111.111:49743 ...
. 2019-03-04 17:47:56.855 Data connection closed
< 2019-03-04 17:47:56.855 150 Opening data channel for directory listing of "/RelatedDocumentUploads/aaaa/bbbb/cccc/dddd/RCJY.O5.K2/Supporting Document"
< 2019-03-04 17:47:56.855 226 Successfully transferred "/RelatedDocumentUploads/aaaa/bbbb/cccc/dddd/RCJY.O5.K2/Supporting Document"
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2016-S1
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2016-S2
. 2019-03-04 17:47:56.856 type=dir;modify=20190224134557; 2017-S1
. 2019-03-04 17:47:56.856 type=dir;modify=20190224134557; 2017-S2
. 2019-03-04 17:47:56.856 type=dir;modify=20190224134600; 2018-S1
. 2019-03-04 17:47:56.856 type=dir;modify=20190224134600; 2018-S2
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2019-S1
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2019-S2
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2020-S1
. 2019-03-04 17:47:56.856 type=dir;modify=20181025073148; 2020-S2
. 2019-03-04 17:47:56.856 Directory listing successful
. 2019-03-04 17:47:56.857 ..;D;0;1899-12-30T02:00:00.000Z;0;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2016-S1;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2016-S2;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2017-S1;D;0;2019-02-24T13:45:57.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2017-S2;D;0;2019-02-24T13:45:57.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2018-S1;D;0;2019-02-24T13:46:00.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.857 2018-S2;D;0;2019-02-24T13:46:00.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.858 2019-S1;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.858 2019-S2;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.858 2020-S1;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:56.858 2020-S2;D;0;2018-10-25T07:31:48.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:47:59.134 Changing directory to "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2016-S2".
> 2019-03-04 17:47:59.139 CWD /RelatedDocumentUploads/aaaa/bbbb/cccc/dddd/RCJY.O5.K2/Supporting Document/2016-S2
< 2019-03-04 17:47:59.627 250 CWD successful. "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2016-S2" is current directory.
. 2019-03-04 17:47:59.627 Getting current directory name.
> 2019-03-04 17:47:59.628 PWD
< 2019-03-04 17:48:00.123 257 "/RelatedDocumentUploads/aaaa/bbb/cccc/ddd/RCJY.O5.K2/Supporting Document/2016-S2" is current directory.
. 2019-03-04 17:48:00.124 Retrieving directory listing...
> 2019-03-04 17:48:00.124 TYPE A
< 2019-03-04 17:48:00.617 200 Type set to A
> 2019-03-04 17:48:00.618 PASV
< 2019-03-04 17:48:01.113 227 Entering Passive Mode (10,110,103,31,215,238)
> 2019-03-04 17:48:01.113 MLSD
. 2019-03-04 17:48:01.113 Connecting to 10.110.103.31:55278 ...
. 2019-03-04 17:48:02.095 Data connection closed
< 2019-03-04 17:48:02.096 150 Opening data channel for directory listing of "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2016-S2"
< 2019-03-04 17:48:02.096 226 Successfully transferred "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2016-S2"
. 2019-03-04 17:48:02.096 <Empty directory listing>
. 2019-03-04 17:48:02.096 Directory listing successful
. 2019-03-04 17:48:02.096 ..;D;0;1899-12-30T02:00:00.000Z;0;"" [0];"" [0];---------;0
. 2019-03-04 17:48:06.055 Cached directory change via "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2017-S2" to "/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2".
. 2019-03-04 17:48:06.055 Getting current directory name.
. 2019-03-04 17:48:06.061 Retrieving directory listing...
> 2019-03-04 17:48:06.061 CWD /RelatedDocumentUploads/aaa/bbb/ccc/dddd/RCJY.O5.K2/Supporting Document/2017-S2
< 2019-03-04 17:48:06.553 250 CWD successful. "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2017-S2" is current directory.
> 2019-03-04 17:48:06.553 PWD
< 2019-03-04 17:48:07.047 257 "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2017-S2" is current directory.
> 2019-03-04 17:48:07.048 TYPE A
< 2019-03-04 17:48:07.539 200 Type set to A
> 2019-03-04 17:48:07.539 PASV
< 2019-03-04 17:48:08.034 227 Entering Passive Mode (10,110,103,31,206,23)
> 2019-03-04 17:48:08.034 MLSD
. 2019-03-04 17:48:08.034 Connecting to 10.110.103.31:52759 ...
< 2019-03-04 17:48:11.885 150 Opening data channel for directory listing of "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2017-S2"
. 2019-03-04 17:48:11.885 Data connection closed
. 2019-03-04 17:48:11.885 type=file;modify=20180116032646;size=56290; RCJY O5.K2 -D6(Q4) 2017-Doc 1.JPG
. 2019-03-04 17:48:11.885 type=file;modify=20180116032658;size=304601; RCJY O5.K2 -D6(Q4) 2017-Doc 2.pdf
. 2019-03-04 17:48:11.885 type=dir;modify=20190224134558; الجبيل ورأس الخير
. 2019-03-04 17:48:11.886 type=file;modify=20180118145415;size=1223036; تقرير الربع الرابع لمؤشرات الهيئة الملكية للجبيل وينبع 2017 (006)senton(18-01-2017).pdf
< 2019-03-04 17:48:11.886 226 Successfully transferred "/RelatedDocumentUploads/aaa/bbb/ccc/ddd/RCJY.O5.K2/Supporting Document/2017-S2"
. 2019-03-04 17:48:11.886 Directory listing successful
. 2019-03-04 17:48:11.886 ..;D;0;1899-12-30T02:00:00.000Z;0;"" [0];"" [0];---------;0
. 2019-03-04 17:48:11.886 RCJY O5.K2 -D6(Q4) 2017-Doc 1.JPG;-;56290;2018-01-16T03:26:46.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:48:11.886 RCJY O5.K2 -D6(Q4) 2017-Doc 2.pdf;-;304601;2018-01-16T03:26:58.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:48:11.886 علم علم علم علم;D;0;2019-02-24T13:45:58.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:48:11.887 التقرير التقرير التقرير التقرير القريري2017 (006)senton(18-01-2017).pdf;-;1223036;2018-01-18T14:54:15.000Z;3;"" [0];"" [0];---------;0
. 2019-03-04 17:48:20.443 Copying 1 files/directories to local directory "C:\Users\yser\Documents\" - total size: 1,223,036
. 2019-03-04 17:48:20.443   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: Yes; Mask: *.*
. 2019-03-04 17:48:20.443   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2019-03-04 17:48:20.443   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2019-03-04 17:48:20.443 File: '/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير2017 (006)senton(18-01-2017).pdf' [2018-01-18T14:54:15.000Z] [1223036]
. 2019-03-04 17:48:20.447 Copying "/RelatedDocumentUploads/aaa/bbb/ccc/dddd/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf" to local directory started.
. 2019-03-04 17:48:20.448 Binary transfer mode selected.
. 2019-03-04 17:48:20.448 Starting download of /RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf
. 2019-03-04 17:48:20.449 Asking user:
. 2019-03-04 17:48:20.449 **Overwrite local file 'تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf'?**
. 2019-03-04 17:48:20.449 
. 2019-03-04 17:48:20.449 Destination directory already contains file 'تقرير تقرير تقرير تقرير تقرير2017 (006)senton(18-01-2017).pdf'.
. 2019-03-04 17:48:20.449 Choose, if you want to overwrite the file or skip this transfer and keep existing file.
. 2019-03-04 17:48:20.449  
. 2019-03-04 17:48:20.449 New:          1,223,036 bytes, 1/18/2018 4:54:15 PM
. 2019-03-04 17:48:20.449 Existing:     1,223,036 bytes, 1/18/2018 4:54:15 PM ()
> 2019-03-04 17:48:21.721 TYPE I
< 2019-03-04 17:48:22.207 200 Type set to I
> 2019-03-04 17:48:22.207 PASV
< 2019-03-04 17:48:22.702 227 Entering Passive Mode (10,110,103,31,236,137)
> 2019-03-04 17:48:22.712 RETR تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf
. 2019-03-04 17:48:22.712 Connecting to 10.110.103.31:60553 ...
< 2019-03-04 17:48:24.082 150 Opening data channel for file download from server of "/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf"
. 2019-03-04 17:48:30.748 Data connection closed
< 2019-03-04 17:48:30.748 226 Successfully transferred "/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf"
. 2019-03-04 17:48:30.748 Preserving timestamp [2018-01-18T14:54:15.000Z]
. 2019-03-04 17:48:30.750 Download successful
. 2019-03-04 17:48:30.750 Transfer done: '/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf' => 'C:\Users\osmohame\Documents\تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf' [1223036]
. 2019-03-04 17:48:30.766 Copying finished: Transferred: 1,223,036, Elapsed: 0:00:10, CPS: 182,733/s
. 2019-03-04 17:48:37.731 Disconnected from server

And this is the code that initializes the connection to the FTP server:

logger.info("Creating the ftp connection using the details");
String ftpServerAddress = wccInstanceDetails.get("ftpServer");
String ftpPort = wccInstanceDetails.get("ftpPort");
String ftpUserName = wccInstanceDetails.get("ftpUser");
String ftpPassword = wccInstanceDetails.get("ftppassword");
FTPClient ftpClient = new FTPClient();
try {
    //added here
    ftpClient.setAutodetectUTF8(true);

    ftpClient.connect(ftpServerAddress, Integer.parseInt(ftpPort));
    ftpClient.login(ftpUserName, ftpPassword);
    ftpClient.enterLocalPassiveMode();
    ftpClient.setFileType(FTP.ASCII_FILE_TYPE);
} catch (IOException ex) {
    logger.error("Error occurs while creating the FTP connection : " + ex.getMessage());
}
return ftpClient;

After adding the setautodetectUTF(true), the output is changed, but the file is downloaded corrupted:

2019-03-04 16:05:10 INFO  FtpConnection:17 - Creating the ftp connection using the details
2019-03-04 16:05:10 INFO  FtpConnection:19 - 10.110.103.31
2019-03-04 16:05:10 INFO  FtpConnection:21 - 21
2019-03-04 16:05:10 INFO  FtpConnection:38 - true
220-FileZilla Server 0.9.60 beta
220-
220 EMP FTP
FEAT
211-Features:
 MDTM
 REST STREAM
 SIZE
 MLST type*;size*;modify*;
 MLSD
 UTF8
 CLNT
 MFMT
 EPSV
 EPRT
211 End
USER *******
331 Password required for epmftp
PASS *******
230 Logged on
TYPE A
200 Type set to A
PASV
227 Entering Passive Mode (10,110,103,31,224,65)
RETR /RelatedDocumentUploads\Entities\RCJY\KPI\Documents\RCJY.O5.K2\Supporting Document\2017-S2\تقرير تقرير تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf
150 Opening data channel for file download from server of "/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير تقرير تقرير تقرير تقرير تقرير 2017 (006)senton(18-01-2017).pdf"
226 Successfully transferred "/RelatedDocumentUploads/Entities/RCJY/KPI/Documents/RCJY.O5.K2/Supporting Document/2017-S2/تقرير الربع الرابع لمؤشرات تقرير تقرير تقرير (006)senton(18-01-2017).pdf"
Martin Prikryl :

You may need to use UTF-8 encoding. First thing to try is to call FTPClient.setAutodetectUTF8:

ftpClient.setAutodetectUTF8(true);

(call that before connecting)

That should fix the problem your question is about.


Once you resolve the file name issue, you will need to fix transfer mode issue. You are transferring binary files (PDF) in text mode.

You need to use binary mode:

ftpClient.setFileType(FTP.BINARY_FILE_TYPE);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=151358&siteId=1