Post a reply

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

The 20170601_121717.txt is saved in UTF-16 encoding without a BOM.

While the 20170601_121717_savedInNotepad.txt has the BOM. Note that it's two bytes larger (that's the BOM).

WinSCP needs either UTF-8-encoded script file; or a BOM to identify, that the file uses a different UTF encoding (such as UTF-16)
See https://winscp.net/eng/docs/scripting#using_scripting
konraddo

Okay, so i post attachment with script that i'm executing (i'm not pasting it on pastebin.com or somewhere else because it could possibly affect encoding?).

This is how i execute this script:

winscp.com /script=G:\Synchronize_photos\20170601_121717.txt
this gives me this error:
Ambiguous command 'o'. Possible matches are: open, option.

When i try to execute another version of this script (edited and saved in Notepad without doing any modifications), WinSCP successfully executes this script:
winscp.com /script=G:\Synchronize_photos\20170601_121717_savedInNotepad.txt
Searching for host...
Network error: Connection to "examplewebsite.com" timed out.
which is of course fine because i changed actual URL with this fake example.
martin

Re: Encoding problem when executing a WinSCP script generated using MS SQL Server

Show us some code.
konraddo

Encoding problem when executing a WinSCP script generated using MS SQL Server

Hello, i have a problem:
I'm using WinSCP to upload files to a server using script, since I store files list in MS SQL database, I tried to create a script for WinSCP from SQL Stored procedure by concatenating strings and saving results to file using SQL CLR assembly, but it seems there's a problem with newline characters - in SQL i use CHAR(13) + CHAR(10) and when i'm trying to connect to server using WinSCP i've got error:
"Ambiguous command 'o'. Possible matches are: open, option".
But when I edit this script manually in notepad.exe, even if i don't edit a single character and save it, it works. How should i properly handle newline characters for WinSCP?
Or is there a way to change accepted encoding of scripts in WinSCP? I googled about encoding settings in WinSCP but if i understand correctly, you can change encoding of files transferred using WinSCP, not encoding of the WinSCP script.