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

pmsousa

Encoding UTF-8 and .NET assembly / COM Library

Hi,

I'm using a PowerShell script (I've seen on this Forum similar posts using the same base PowerShell script) to Sync Directories (.SynchronizeDirectories) but I'm having a problem with character encoding.

I'm from Portugal and we use accents and other special characters when writing, so it's normal for user to use those characters on file and folder names.

If I connect to my remote host (Linux based) with WinSCP and set the UTF-8 Encoding from "Auto" to "On", the remote files and folders are shown correctly with accents and other special characters (like ç); with "Auto" the "special" characters become garbage.

My first PowerShell script used the $sessionOptions.Protocol = [WinSCP.Protocol]::Sftp but my local files and folder names with special characters become garbage. My second attempt was to find if there was an option to set the UTF-8 Encoding to "On" on the Session Class but there's none. I've also read something on the Forum about the ability to use UTF with the protocols Sftp and Scp; so I've switched the protocol to Scp ($sessionOptions.Protocol = [WinSCP.Protocol]::Scp) but also the same result.