fix some code style and make char encoding more clear