This project is read-only.

How to enter the folder with diacritics

Jan 20, 2013 at 12:30 PM
Edited Jan 20, 2013 at 12:30 PM


I have a problem with running commands with diacritics. I am Slovak and we have letters like 'ž' or 'č'. When I have a folder called "čž" and I run a command "cd čž" I get an error "bash: line 0: cd: cr: No such file or directory".


Is it possible to send command with diacritics or is this an ssh limitation?

Jan 20, 2013 at 2:09 PM




Try to use CreateCommand when you creating you command and provide appropriate encoding.

For example:

CreateCommand(commandText, Encoding.UTF8);

But in your case simply use different encoding and let me know if it works.




Jan 20, 2013 at 3:08 PM

Hi Oleg,


thank you for your answer.

i tried many codings that should work for my diacritics but finally nothing worked.  Windows-1250 was the closest, it recognized at least 'š' so when I wrote cd češ, I got an error "bash: line 0: cd: ceš: No such file or directory" but I still couldnt get it work.

Jan 20, 2013 at 3:29 PM


Ok, let me to investigate this issue further then :(:(.




Jan 20, 2013 at 3:38 PM

I will write what I'm trying to do. I'm connected to my ssh server runing on Ubuntu. I'm running two commands in one, seperated by ";" (something like "cd blabla; ls -l) so I get the items in the folder. When I use the default encoding I get the name of items with any problem, diacritics is there. But when I use diacritics in the comand ("cd čřšč; ls -l") I get an error that the folder doesnt exist. When I use some other encoding (windows1250 or ISO-8859-2) that should be able to work with my diacritics, I even get the wrong names of items (I get ÄÄ›ĹĄ and čŠinstead of češ and čř (those are names of folders)).

I hope it helps you.

Jan 21, 2013 at 3:02 AM


I just made some changes and fixes so I think it should work now. In my tests I could create files and run commands and get result I expected.

Here is a code example.

            using (SshClient ssh = new SshClient(connectionInfo))
                var cmd = ssh.CreateCommand("echo \"С Рождеством\"", Encoding.GetEncoding(1251));
                var result = cmd.Execute();

Or you can also specify encoding in connection object. I added a new property called Encoding which does just that so here is another example:

            connectionInfo.Encoding = Encoding.GetEncoding(1251);
            using (var scp = new ScpClient(connectionInfo))
                scp.Upload(new FileInfo(@"D:\test.key"), "дество");

Please let me know if you have any more problems or questions.