Post a reply

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)


Topic review


Re: How to remove BOM (byte order mark)

There's no API for that in WinSCP .NET assembly. But you can remove it programmatically yourself before upload.

How to remove BOM (byte order mark)


I am using the following code, how can i remove the BOM?


                ' Setup session options
                Dim sessionOptions As New SessionOptions
                With sessionOptions
                    .Protocol = Protocol.Sftp
                    .HostName = My.Settings.SFTPServer
                    .UserName = My.Settings.SFTPUsername
                    .Password = My.Settings.SFTPPassword
                    .PortNumber = My.Settings.SFTPPort
                    .SshHostKeyFingerprint = My.Settings.SSHKeyFingerPrint
                End With

                Using session As Session = New Session
                    ' Connect

                    ' Upload files
                    Dim transferOptions As New TransferOptions
                    transferOptions.TransferMode = TransferMode.Binary

                    Dim transferResult As TransferOperationResult
                    transferResult = session.PutFiles("c:\bla.xml", My.Settings.SFTPRemoteUploadPath, False, transferOptions)

                    ' Throw on any error

                    ' Print results
                    Dim transfer As TransferEventArgs
                    For Each transfer In transferResult.Transfers
               ("Uploaded: " & transfer.FileName)
                End Using
            Catch e As Exception
            End Try

Thanks in advance