Incorrect file name encoding using PhpStorm / WinSCP and SFTP

My host has disabled FTP, so I have to use SFTP, but I ran into some strange problems with PhpStorm since I switched to SFTP. My file names sometimes have German umlauts such as Lösungsblatt or Übungsblatt , and they usually loaded correctly and the host window displayed the files correctly. Since I have to use old SFTP files on the remote host as shown

enter image description here

and recently uploaded files display correctly in PhpStorm. However, in WinSCP, the old files are displayed correctly as Lösungsblatt-01.pdf , etc., but the files that appear to have been downloaded correctly through PhpStorm are corrupted because they are displayed as

enter image description here

which is basically the opposite. I have a feeling that the UTF-8 and UTF-16 file names are mixed during the download process, so I was curious how I can configure the IDE to (1) display the file names in the remote tree correctly and (2) load the files correctly correct encoding (not encoding the content, but encoding the file name itself!)

+5
source share
1 answer

In the SFTP protocol, file names must be in UTF-8. Although in fact it is only from version 4. In older versions, no specific encoding was specified. Thus, the implementations are different. Some use UTF-8, but many (perhaps most) use the standard encoding of the system (for example, standard Windows Ansi encoding).

The latest version of WinSCP always uses UTF-8, even for servers that implement SFTP version 3 (or older), such as OpenSSH. In fact, OpenSSH has no idea about the encoding. It uses any encoding used by the base system. Since most * nix systems use UTF-8 by default, this just works.

I assume that PhpStorm actually uses Ansi's default encoding by default (which will be Windows-1252 for "western languages"). You can also force WinSCP to use this by setting "UTF-8 Encoding for File Names" to "Off." Although you really should force PhpStorm to use UTF-8.

0
source

All Articles