1. fix non-ascii characters length
2. fix client-socket close
3. remove trailing space
Merge pull request #33 from HerringtonDarkholme/master

several bug fixes