File with non-english fileName fails to upload on SFTP?

107 Views Asked by At

I am using the following script to upload to SFTP. It works fine except if the filenames have non-english chars.

import pexpect
fileName = raw_input("Enter fileName")
#in the pexpect, send the following
put_string = "put {} /test/{}".format(fileName)
p.sendline(put_string)

My observation

Actual filename = 法嫁

fileName = \xe6\xb3\x95\xe5\xab\x81

put string = put \xe6\xb3\x95\xe5\xab\x81 /test/\xe6\xb3\x95\xe5\xab\x81

How can I resolve this issue ? Does SFTP support this type of PUT ? If no, how to upload non-eng chars file.

Versions

  1. python2.7

Note - I have tried storing this as unicode, but same issue happens.

0

There are 0 best solutions below