SSH/SFTP Downloading Text file produces strange characters?
Question:
I receive strange characters when downloading a text file using ReadFileText. Why does this happen?
Answer:
Using SSH/SFTP, files are downloaded exactly as-is byte-for-byte except if you call the ReadFileText* methods. The ReadFileText* methods require a charset (i.e. character encoding) to be specified in the method arguments. This allows the method to interpret the bytes according to a specific character encoding (such as utf-8, windows-1252, Shift_JIS, etc.) and then return the correct string (because strings in programming environments using ActiveX, or languages such as C#, VB.NET, Java, etc are objects with an internal Unicode representation).
admin
0
Tags :