반응형
File "c:\Python25\lib\httplib.py", line 711, in send
self.sock.sendall(str)
File "<string>", line 1, in sendall:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 74: ordinal not in range(128)
해결 방법
소켓에서 바이트 집합을 읽었습니다. 문자열을 원한다면 디코딩해야합니다.
yourstring = receivedbytes.decode("utf-8")
( utf-8
에 사용중인 인코딩으로 대체)
그런 다음 반대로 다시 보내야합니다.
outbytes = yourstring.encode("utf-8")
참조 페이지 https://stackoverflow.com/questions/1644640
반응형
'파이썬' 카테고리의 다른 글
파이썬 Delete the first three rows of a dataframe in pandas (0) | 2021.01.17 |
---|---|
파이썬 Python Numpy-복소수-극성에서 직사각형으로 변환하는 기능이 있습니까? (0) | 2021.01.17 |
파이썬에 주문 된 세트가 있습니까? (0) | 2021.01.17 |
파이썬으로 웹 사이트에 로그인하고 기계화하는 방법 (0) | 2021.01.16 |
파이썬 2 자리 연도로 문자열 날짜를 구문 분석하는 방법은 무엇입니까? (0) | 2021.01.16 |
댓글