2020年8月5日星期三

Encoding Issue Of Transfer files by Winscp cmd between Windows and linux. -Don't fogot to use UTF-8

I was writing an auto tool by VBA. 
The requirements are:
 1. Transfer sources from some windows folders. These folders' path is saved in a list.
 2. Then invoke compile cmd on Linux Server.
 3. Download the compile result log from Linux Server.
 
The functions are:
1. List the destination folders on VBA
2. Make .scp file for WINSCP.exe. Then using the under command to transfer files.
    open sftp://username:password@hostname/
    # set transfer mode (binary or ASCII)
    # I want to transfer java sources, so it should be ASCII
    option transfer ASCII
    
    cd /home/username/workfolder
    # delete the old source folder if it exist. 
    call ./precompile.sh ./tmp_src  
    
    # change the local current directory to the source folder 
     lcd c:\temp\sourcefolder/
    # transfer all files to the Linux server.
    put * 
    # if download files from Linux Server should using get *.
    
    #close the winscp session
    close 
    #exit the winscp
    exit 

The Encoding Issue is I am using Windows 10 Japanese, and I save the .scp file as S-JIS, and It's OK with Japanese words in it on windows, but when it is transferred to Linux by Winscp. No error messages are shown, In fact, nor anything else shown.
Then I change the .scp file encoding to UTF-8, it works ok.

没有评论: