move the position of set encoding

reload(sys) has been put before loading of channel.json.

Once there are utf-8 characters in channel.json, like user name, it may encounter a encoding error.