From c2341a175fdd755a34965ff63c7ea437b380352d Mon Sep 17 00:00:00 2001 From: David Rubio Date: Fri, 24 Aug 2012 17:45:14 +0200 Subject: [PATCH] Fixed a bug that prevented Yacy from indexing files with non ASCII filenames in FTP servers. Previously Yacy could read file listings in UTF-8, but couldn't send commands to the FTP server in UTF-8 (the second byte of every multi-byte character was ignored), which caused a lot of errors on the server side. Now it handles UTF-8 correctly. --- source/net/yacy/cora/protocol/ftp/FTPClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/cora/protocol/ftp/FTPClient.java b/source/net/yacy/cora/protocol/ftp/FTPClient.java index d7ff3d697..120982967 100644 --- a/source/net/yacy/cora/protocol/ftp/FTPClient.java +++ b/source/net/yacy/cora/protocol/ftp/FTPClient.java @@ -1969,7 +1969,8 @@ public class FTPClient { // protocoll socket commands private void send(final String buf) throws IOException { - this.clientOutput.writeBytes(buf); + byte[] b = buf.getBytes("UTF-8"); + this.clientOutput.write(b, 0, b.length); this.clientOutput.write('\r'); this.clientOutput.write('\n'); this.clientOutput.flush();