ianva / vim-youdao-translater

vim的有道取词翻译插件
ianva.github.com
Other
132 stars 32 forks source link

Add python3 support for this plugin. #16

Closed ketor closed 7 years ago

ketor commented 7 years ago

Signed-off-by: KetorD d.ketor@gmail.com

Fix #15

ketor commented 7 years ago

@ianva Please review. Thanks!

ianva commented 7 years ago

I'm afraid, I can't merge this code because it‘s unmaintainable.

You can create a util method like superEncode, it encapsulate difference between python2 and python3, and then superEncode is used to replace String.encode of original code.

ketor commented 7 years ago

@ianva Refactored the py2/py3 compatibility code now. Please review. Thanks!

ketor commented 7 years ago

Add 4 new methods: str_encode, str_decode, bytes_decode, url_quote. Now all py2/py3 compatibility processing is in these methods, so the main code logic is clear.

ketor commented 7 years ago

Tested on my mac with vim(+python) and MacVim(+python3).