send special character in command

Sep 15, 2011 at 10:47 AM

Hi,

is it possible to send special character in a command?

Like this: 

 

var cmd = sshClient.CreateCommand("touch /tmp/test/testkköäüt",Encoding.UTF8);
cmd.Execute();

The createt File will contain questionmarks instead of öäü (testkk???t). What am I doing wong?

 

Coordinator
Sep 15, 2011 at 1:26 PM

I currently did some fix, to handle characters other then ascii so you might want to download latest versions of the code.

Also, I tried to run similar command here and it worked now, but now it translates everything into UTF-8 so if you have not ascii characters it will be sent as UTF-8.

 

See if it works for you and let me know.

 

I am not so familiar with international support on unix so I dont know how much I could help there.

 

Thanks,

Oleg

Sep 15, 2011 at 6:20 PM

Hi,

great work!!!
It seems to work for me.

Thanks:)

Apr 13, 2012 at 6:55 AM

Hi olegkap,

i am searching for library, which will be able to configure the connection to interpret different encoding on the server.
I noticed that CreateCommand uses Renci.SshNet.Common.ASCIIEncoding only.

Is there any other way how to configure custom server encoding for connection?

And what is the purpose of custom ASCII encoding class, which replaces the System.Text.Encoding.ASCII?

Coordinator
Apr 13, 2012 at 12:41 PM

Hi,,

 

Yes, you can provide your own encoding if you wish. You can pass your encoding to CreateCommand as second parameter.

The reason I have custom ASCIIEncoding is to provide support Silverlight and WindowsPhone versions since this class is not available in that runtime.

 

Thanks,

Oleg