Fix UnicodeEncodeError when adding selected hunk

If selected hunk contians non ascii characters when adding the hunk,
UnicodeEncodeError is raised. Adding encode() fixes the error.
Fix Type error on add selected hunk

This fixes the following error on add selected hunk.
`TypeError: generic_done() got an unexpected keyword argument 'stdin'`