mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-12 19:45:22 +02:00
Bug 236334 - [ssh][encodings] Cannot copy files or folders with turkish or arabic names
This commit is contained in:
parent
2ac14ae969
commit
1fefdf21dc
1 changed files with 14 additions and 1 deletions
|
@ -1070,7 +1070,20 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
||||||
Channel channel = null;
|
Channel channel = null;
|
||||||
try {
|
try {
|
||||||
channel=fSessionProvider.getSession().openChannel("exec"); //$NON-NLS-1$
|
channel=fSessionProvider.getSession().openChannel("exec"); //$NON-NLS-1$
|
||||||
((ChannelExec)channel).setCommand(command);
|
try {
|
||||||
|
// ChannelExec#setCommand(byte[]) was added in JSch-0.1.38 only
|
||||||
|
((ChannelExec) channel).setCommand(command.getBytes(fJSchChannelEncoding));
|
||||||
|
} catch (NoSuchMethodError nsm) {
|
||||||
|
// Fallback for JSch-0.1.37 and below: always decodes in
|
||||||
|
// Platform Default Encoding!
|
||||||
|
byte[] bytesDesired = command.getBytes(fJSchChannelEncoding);
|
||||||
|
String stringToSend = new String(bytesDesired);
|
||||||
|
byte[] bytesSent = stringToSend.getBytes();
|
||||||
|
if (!bytesDesired.equals(bytesSent)) {
|
||||||
|
throw new UnsupportedEncodingException("Cannot encode for JSch as \"" + fJSchChannelEncoding + "\": " + command);
|
||||||
|
}
|
||||||
|
((ChannelExec) channel).setCommand(new String(bytesDesired));
|
||||||
|
}
|
||||||
|
|
||||||
//No user input
|
//No user input
|
||||||
channel.setInputStream(null);
|
channel.setInputStream(null);
|
||||||
|
|
Loading…
Add table
Reference in a new issue