Skip to content

add optional parameter 'encoding' and 'errors' to most functions in sftp_client.py - #1716

Closed
hakaishi wants to merge 11 commits into
paramiko:mainfrom
hakaishi:add_encoding
Closed

hakaishi wants to merge 11 commits into
paramiko:mainfrom
hakaishi:add_encoding

Conversation

@hakaishi

@hakaishi hakaishi commented Jul 13, 2020 •

Copy link
Copy Markdown

related to #546 #1631 #1365 #1443

This adds encoding and errors for most sftp client functions.

file.py also needed to be adjusted.

Why did I prefer adding the optional parameter "encoding" instead of only adding "errors"?
Well, this way the user can choose the encoding if he wants. If the remote doesn't support utf-8 or the folder includes file names using another encoding than utf-8, you would not be able to work with these files in any way. Only adding encoding will ensure that.
Most users will know the encoding used by the remote system, so I would not see any difficulties there either.

Rewriting the code to only use binary internally would be a rather big change to the code, I guess. So this is why I would prefer to simply add an optional parameter defaulting to the current usage inside paramiko.

I ran some local tests and also pytest to ensure that no code has been broken by my changes.

Best regards,
Hakaishi

@hakaishi hakaishi changed the title add optional parameter 'encoding' to functions related listdir() and readlines() add optional parameter 'encoding' and 'errors' to most functions in sftp_client.py Jul 25, 2020
@ppom0

ppom0 commented Nov 5, 2021

Copy link
Copy Markdown

This feature would be very much appreciated!

@hakaishi

Copy link
Copy Markdown
Author

I guess this is too old already. I'll try to merge the changes to my fork in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants