net-ssh / net-sftp

Pure Ruby implementation of an SFTP (protocols 1-6) client.
http://net-ssh.github.io/
MIT License
286 stars 130 forks source link

Fix multibyte string write #110

Closed MatjazKavcic closed 3 years ago

MatjazKavcic commented 4 years ago

Fixes writing of string with multibyte UTF8 characters. The position was calculated based on string size, which was incorrect since position should be in bytes.

The result was that when using file.puts for streaming, data would get overwritten (since the calculated position was too small).

Added test with 3 byte chinese characters.

MatjazKavcic commented 3 years ago

Can someone with write access merge this please? Thanks!

vknightbd commented 3 years ago

@mfazekas do you have write access to this project?