As I mentioned before, you shouldn't encode something that was a `str` to begin with. You *encode* `unicode` objects, and *decode* `str` objects. It won't cause an error, but it's confusing. In this case, you should be able to simply send `msg` right away, because you will now for sure that it won't contain any non-ascii characters.