Fixed a bug of converting character code