PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.44k stars 762 forks source link

[SFTP Bug Report] Unable to upload/see files/folders with name "*夹*" #1382

Closed pandolia closed 4 years ago

pandolia commented 5 years ago

"OpenSSH for Windows" version 7.9.0.0

Server OperatingSystem Windows Server 2012 R2 Standard

Client OperatingSystem Windows 7 Ultimate

Client FTP Software WinSCP 5.15.1 (Build 9407) FileZilla 3.42.1

What is failing 1. Upload files/folders with name "*夹*", i.e, "新建文件夹", "123夹", "abc夹abc". 2. See server's files/folders with name "*夹*".

Expected output Upload/see all kinds of files/folders.

Actual output 1. When uploading a folder "新建文件夹", or a folder "123夹": 20190511095401

2. When listing files/folders of the server, the folder "新建文件夹" and the file "123夹" are lost.

Other Files/Folders File/folder without "夹" in its name (i.e, "新建文件", "abc", ... ) can be uploaded/seen.

Other Servers When connecting to an Ubuntu ssh server with WinSCP/FileZilla, all kinds of files/folders can be uploaded/seen.

nonylours commented 5 years ago

I had the same the problem. Some (but not all) folders/files with Japanese kanjis were invisible with SFTP. I could workaround it by changing the System Locale from Japanese to English in the control panel.

yuliu commented 5 years ago

I'm not sure if my problem is related to this one.

I'm using Windows 10's built-in OpenSSH sftp server and connect to it from a remote PC using WinSCP. Some operations fail and I report it to WinSCP. The WinSCP developer checked and found it's Windows sftp server's fault who doesn't send back correct UTF-8 encoded contents.

The post I've posted in WinSCP is here, and the developer's response is:

And that actually what the server returns. Not WinSCP fault. WinSCP asks the server for a canonical path to /E:/temp/上线前备份 and the server returns /E:/temp/上线前备 followed by an invalid UTF-8 code. That makes WinSCP believe the server does not use UTF-8 encoding and falls back to a legacy encoding, what breaks everything after. Again, not really WinSCP fault.

The OSes & softwares I'm using are:

pd12bbf7608ae1 commented 4 years ago

I'm not sure if my problem is related to this one.

I'm using Windows 10's built-in OpenSSH sftp server and connect to it from a remote PC using WinSCP. Some operations fail and I report it to WinSCP. The WinSCP developer checked and found it's Windows sftp server's fault who doesn't send back correct UTF-8 encoded contents.

The post I've posted in WinSCP is here, and the developer's response is:

And that actually what the server returns. Not WinSCP fault. WinSCP asks the server for a canonical path to /E:/temp/上线前备份 and the server returns /E:/temp/上线前备 followed by an invalid UTF-8 code. That makes WinSCP believe the server does not use UTF-8 encoding and falls back to a legacy encoding, what breaks everything after. Again, not really WinSCP fault.

The OSes & softwares I'm using are:

* local:
  Windows 10 x64 Pro 1903 (18362.449) Chinese
  WinSCP 5.15.5 9925 with Chinese Simplified language pack.

* remote:
  Windows 10 x64 Ent 1903 (18362.449) Chinese
  Windows's built-in OpenSSH server
  with Default shell changed to `C:\Program Files\Git\bin\bash.exe`
  (via https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration#configuring-the-default-shell-for-openssh-in-windows )
  Git 2.23.0.windows.1
  OpenSSH SFTP 7.7.2.1 (OpenSSH_7.7p1 for Windows)
  The SFTP server invoked by OpenSSH is `C:\Windows\System32\OpenSSH\sftp-server.exe` which is the Windows's built-in one.

I met the same problem with many non-English character. Sometimes file's name with 【】 or other Chinese and Japanese characters won't display at all. Enter a folder with non-English characters name usually result an error.

It may solve if I choose to use UTF-8 in setting Language for non-Unicode programs, which was Chinese (Simplified, China) before I use the SFTP server. But some of my programs (except SFTP server) won't display Chinese characters correctly under UTF-8.

Is there a solution that I can use UTF-8 code to run OpenSSH server without change setting Language for non-Unicode programs?

The OSes & softwares I'm using are:

server: Windows 10 x64 Pro 10.0.18363 N/A Build 18363 Windows's built-in OpenSSH server

client: FileZilla 3.44.2 Windows's built-in OpenSSH client

All Windows's built-in OpenSSH is 7.7.2.2

maertendMSFT commented 4 years ago

Please try this on the latest release, 8.1: https://github.com/PowerShell/Win32-OpenSSH/releases/tag/v8.1.0.0p1-Beta

pandolia commented 4 years ago

@maertendMSFT Thank you for fixing this.