1. fix non-ascii characters length
2. fix client-socket close
3. remove trailing space