Python3 requests Chinese garbled UnicodeEncodeError: 'latin-1' codec can`t encode characters in ……

When using response.post to send json data with Chinese, the error shown in the title appears because of encoding problems

data = "tell a joke"

# Solution: encoded into bytes (utf-8) is re-decoded format latin1

data=data.encode("utf-8").decode("latin1")

Guess you like

Origin www.cnblogs.com/xtmp/p/12693862.html