fix encode error for multibyte charsets
Merge pull request #28 from item4/encode

fix encode error for multibyte charsets (close #27)