+1 vote
by (170 points)
edited by


I cannot download files with umlauts like ä,ö,ü. The following exception is thrown:

Exception thrown: 'Rebex.Net.SftpException' in Rebex.Sftp.dll
Exception thrown: 'Rebex.Net.SftpException' in Rebex.Sftp.dll
Exception thrown: 'Rebex.Net.SftpException' in System.Private.CoreLib.dll
download failed: Rebex.Net.SftpException: No such file; No such file.
at nhyfy.rlvdu.oiejf(brdwk p0, Type p1)
at nhyfy.rlvdu.uvykc(String p0, qikkr p1, Boolean p2, ttafi p3)
at Rebex.Net.Sftp.usclz(ttafi p0, String p1, Stream p2, Int64 p3, Int64 p4, spsof p5)
at Rebex.Net.Sftp.tmzux(FileMode p0, ttafi p1, String p2, String p3, Int64 p4, Int64 p5, Int64 p6, spsof p7)
at Rebex.Net.Sftp.dymkw(Object p0, Enum p1, Object[] p2)
at nhyfy.fuqtf.lauhh(Object p0)
--- End of stack trace from previous location where exception was thrown ---
at Christiani.Services.Network.downloadFileAsync(String remotePath, String localPath, Boolean awaitCall)

Downloading the same file without the 'ä' is no problem and downloading the file with the umlaut 'ä' but with ftp instead of sftp also works.

Is there a chance to solve this issue? My client has a lot of files already containing umlauts and renaming all the files is not an option.

Thanks for any help.


Applies to: Rebex SFTP

1 Answer

+2 votes
by (146k points)
selected by
Best answer

It looks like the client and the server are using different character encoding for some reason.

Please try setting Sftp's Encoding property to the following values and determine whether any of them works:

  • System.Text.Encoding.UTF8
  • Rebex.EncodingTools.GetEncoding("windows-1252")
  • Rebex.EncodingTools.GetEncoding("iso-8859-1")

For example:

var client = new Sftp();
client.Encoding = EncodingTools.GetEncoding("windows-1252")

If none of these work, please create a debug log using Sftp.LogWriter and either post it here or mail it to us for analysis:

var client = new Sftp();
client.LogWriter = new Rebex.FileLogWriter("rebexlog.txt", Rebex.LogLevel.Debug); 
client.Encoding = Encoding.UTF8;
client.ChangeDirectory(...); // change the directory to the one containing the files with umlauts
string[] items = client.GetRawList(); // get a listing of that directory

This would hopefully make it possible to tell what's wrong.

by (750 points)
Makes sense: the server is configured to use UTF-8, so it cannot understand umlaute, when the client uses 1252 encoding or vice versa.

by (146k points)
Rebex SFTP still default to non-UTF-8 encodings with many SFTP v3 servers. This is mostly a legacy from early 2000s where UTF-8 was not as ubiquitous as it is now. I guess we'll switch to using UTF-8 by default in 2021. Thanks for bringing this to our attention!
by (170 points)
Thank you so much!
Changing the encoding to utf-8 before connecting to the server worked with this line of code :
sftp.Encoding = System.Text.Encoding.UTF8;
by (146k points)
Starting with Rebex SFTP R6.0, we use UTF-8 by default.