当前位置: 首页 > 面试题库 >

无法使用Java FTP客户端下载带有阿拉伯名称的文件

欧阳山
2023-03-14
问题内容

我有连接到FTP服务器并下载文件的Java代码。如果文件名包含阿拉伯字母,则始终无法下载。但是,如果是英语,则说明下载成功。

这是我的代码。
如果路径是这样,则无法下载:

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

但是,如果像下面这样就可以正常工作:

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

其余代码:

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客户端来自: public class org.apache.commons.net.ftp.FTPClient

我的代码有什么问题?

这是日志的输出:

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

这是来自WinSCP客户端的日志,该日志成功下载了文件:

. 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: user@10.110.111.111 (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

这是初始化与FTP服务器的连接的代码:

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;

添加setautodetectUTF(true),输出将更改,但文件下载已损坏:

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"

问题答案:

您可能需要使用UTF-8编码。首先尝试致电FTPClient.setAutodetectUTF8

ftpClient.setAutodetectUTF8(true);

(在连接之前先打电话)

那应该解决您的问题有关的问题。

解决文件名问题后,您将需要修复传输模式问题。您正在以文本模式传输二进制文件(PDF)。

您需要使用二进制模式:

ftpClient.setFileType(FTP.BINARY_FILE_TYPE);


 类似资料:
  • 我需要阿拉伯语的位置名称,如果gps启用英语,我使用以下代码。 地址[addressLines=[阿布扎比-阿拉伯联合酋长国"],功能=第3街,admin=阿布扎比,sub-admin=null, locality=阿布扎比,大道=第3街,postalCode=null,国家代码=AE,国家名称=阿拉伯联合酋长国,has纬度=真,纬度=,has经度=真,经度=,电话=空,url=空,额外=空] 我

  • 问题内容: 我使用Java Mail下载阿拉伯文附件文件时遇到问题。 文件名始终是不明确的。 问题是检索附件为非UTF-8字符。 问题答案: 标头是根据RFC 2047中描述的机制(即)编码的,该机制表示与 < encoding> < encoded-bytes>_匹配的标头的部分是字节编码的部分。所述 < 编码>说如何解释的字节数,和(因为它是风格,而不是样式)的 < 编码字节>_是基64编码。

  • 我正在使用扫描仪读取一个阿拉伯语文件,并将文本文件存储在ArrayList中 我有一本字典,里面有一些单词,肯定的和否定的,有thier比率的单词。

  • 客户端 4.0 我们已经对deferreds有些理解了,现在我们可以使用它重写我们的客户端。你可以在 twisted-client-4/get-poetry.py 中看到它的实现。 这里的get_poetry已经再也不需要callback与errback参数了。相反,返回了一个用户可能根据需要添加callbacks和errbacks的新deferred。 def get_poetry(host,

  • 在 Dreamweaver 中将双向流量应用到阿拉伯语和希伯来语文本;使用标签编辑器、“表格”属性和 Div 属性。 在中东和北非版本的此软件中,可通过阿拉伯语和希伯来语使用新的功能和改进功能。 双向文字流 中东语言的文字大多从右向左 (RTL) 书写。但是,一般而言,最常用的形式为双向 (bidi) 文字 - 混用从左向右和从右向左书写的文字。bidi 文字的一个示例是含有阿拉伯语和英语文字的段

  • 我试图使用JAX-RS从REST服务下载一个文件。这是我的代码,它通过发送GET请求调用下载: 然而,我面临着将响应转换为实际文件对象的问题。所以我所做的是以下几点: 创建的文件无效,我调试了代码并注意到输出包含一个类似的字符串(大得多): Superstore.TWB YSI 7 D M 3 F 编辑:引用关于HTTP响应的REST API引用: 反应体 以下内容之一,具体取决于工作簿的格式: