fix encode bug

will work ok in emacs shell mode now.