Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Input to winscp.com has to be in ansi encoding. I do not know VB.NET to show you how to do that.

Edit 2021: In the current versions of WinSCP and Windows, none of this should be an issue, as WinSCP and Windows have full Unicode support now.
DGorthat

Sorry to get back to this topic.
But I have still problems.

in the following example I am not able to send a file with special characters or from a local directory with special characters.

Parameters:
str_HOST = "test@testhost"
str_File = "TEC_20100615.txt"
str_SourceDir = "D:\TxdRxD\ÜBERGABE_TEC\"
str_TargetDir = "/cygdrive/c/Inetpub/sftp/"
 
Const LogName As String = "_sftplog.xml"
 
str_ResultStr = ""
 
'even the next steps do not help because str_targetdir is
'again automatically converted into Unicode16
 
'Dim b_sourcedir() = Encoding.UTF8.GetBytes(str_SourceDir)
'str_SourceDir = Encoding.Default.GetString(b)
 
'Dim b_targetdir = Encoding.UTF8.GetBytes(str_TargetDir)
'str_TargetDir = Encoding.Default.GetString(b)
 
Dim winscp As Process = New Process()
winscp.StartInfo.FileName = "winscp.com"
winscp.StartInfo.Arguments = "/log=" + LogName
winscp.StartInfo.UseShellExecute = False
winscp.StartInfo.RedirectStandardInput = True
winscp.StartInfo.RedirectStandardOutput = True
winscp.StartInfo.CreateNoWindow = True
winscp.Start()
 
' Feed in the scripting commands
winscp.StandardInput.WriteLine("option batch abort")
winscp.StandardInput.WriteLine("option confirm off")
If str_User = "" Then
  winscp.StandardInput.WriteLine("open " & str_HOST)
Else
  winscp.StandardInput.WriteLine("open " & str_User & ":" & str_Password & "@" & str_HOST & IIf(str_PrivateKeyFile <> "", " -privatekey=" & str_PrivateKeyFile, ""))
End If
 
winscp.StandardInput.WriteLine("option transfer binary")
winscp.StandardInput.WriteLine("put """ & str_SourceDir & str_File & """ """ & str_TargetDir & """")
'winscp.StandardInput.WriteLine("ls " & TargetDir)
winscp.StandardInput.Close()
 
Dim output As String = winscp.StandardOutput.ReadToEnd()
 
winscp.WaitForExit()


The logfile:
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="https://winscp.net/schema/session/1.0" name="ftpuser@wsgodi" start="2010-08-03T08:21:03.039Z">
  <upload>
    <filename value="D:\TxdRxD\_BERGABE_TEC\TEC_20100615.txt" />
    <result success="false">
      <message>Datei oder Verzeichnis &quot;D:\TxdRxD\_BERGABE_TEC\TEC_20100615.txt&quot; existiert nicht.</message>
      <message>System Fehler.  Code: 3.
Das System kann den angegebenen Pfad nicht finden</message>
    </result>
  </upload>
</session>

So for me it is unclear how to post parameters like filenames or directories with special characters to winscp.com.
Reading the xml result is OK...

Thanks for the help.

Dirk
DGorthat

Re: Special Characters (German) are changed

Yes thats the problem,

I will switch to XML Logging.

Thank you for your help.

Dirk
martin

Re: Special Characters (German) are changed

So you capture output of the console? Are you aware that Windows console uses different encoding (not Ansi)? You may better try to use XML logging.
DGorthat

Re: Special Characters (German) are changed

martin wrote:

are the wrong characters just shown on the winscp.com console window?

After the download the files themselves are correct.

I am using the ls command to get a file list to compare this with a database.

So the problem is: the names with this special characters will not fit...

Thank you for your help.

Dirk
martin

Re: Special Characters (German) are changed

DGorthat wrote:

Is there a difference between winscp.exe and winscp.com?

Well, yes and no. winscp.com may have possibly problems displaying the special characters correctly. But it saves the file exactly as winscp.exe. So are the files indeed created with wrong characters or are the wrong characters just shown on the winscp.com console window?
DGorthat

Re: Special Characters (German) are changed

Thanks for your help.

Is there a difference between winscp.exe and winscp.com?

winscp.exe displays and copies the files correctly using drag and drop.
winscp.com leads to the problem.
Both versions use the same stored session.

I tried both settings for UTF8 conversion with the same result for the winscp.com.
Winscp.exe ran into a problem when I set UTF-8 conversion it to ON.
It even did not show all files. Starting the connection I get an error message:
Während der Dekodierung einer UTF-8 Zeichenkette ist ein Fehler aufgetreten.

short: Error decoding an UTF-8 character string

Files with special characters even do not appear in the directory structure.

For winscp.com I did not see a difference.

Dirk
martin

Re: Special Characters (German) are changed

Please read FAQ. If that does not help, come back.
DGorthat

Special Characters (German) are changed

Hello together,

I am running winscp 4.2.1 in scripting mode with german translation on a windows xp SP3 German.

The logs or even filenames with special characters show special characters that do not fit to the original ones.

like: instead of ö
ÇÏ instead of ä
 instead of ü
š instead of Ü

That happens only with the winscp.com so the translation seems to be fine.

Here a part of a log of a sinchronization:

Synchronisiere...
Lokal 'D:\TxdRxD\Datei' <= Entfernt '/cygdrive/c/Inetpub/sftp'
'D:\TxdRxD\Datei\LISTE_tcc_20100519_01.dat.gz' gel”scht
'D:\TxdRxD\Datei\VR' gel”scht

My editor shows codepage 1252

For logging that should not be a problem, but when I use the ls command to select a file with this characters for download that causes the problem that the file cannot be found.

Is there any setting in winscp to solve this? Or is that a windows internal problem?

Dirk