it runs perfectly in CMD, or the VScode terminal, but with GitBash it crashes on line 30
anyone could tell me why ?
[heres my program, a Python IRC program]
import socket
import time
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
HOST = 'irc.HOST.org'
PORT = 6667
s.connect((HOST, PORT))
nick_cr = ('NICK thewok \r\n').encode()
s.send(nick_cr)
username_cr= ('USER thewok thewok thewok :thewok \r\n').encode()
s.send(username_cr)
time.sleep(2)
s.send('JOIN #CHANNEL \r\n'.encode()) #chanel
while 1:
data = s.recv(4096).decode('utf-8')
print(data) #that line is causing problems,
#in GitBash, it says :
#line 19, in this .py,
#print(data)
#File "C:\Python39\lib\encodings\cp1252.py", line 19, in encode
#return codecs.charmap_encode(input,self.errors,encoding_table)[0]
#UnicodeEncodeError: 'charmap' codec can't encode characters in position 1456-1465: character maps to <undefined>
if data.find('PING') != -1: #some irc actions
s.send(str('PONG ' + data.split(':')[1] + '\r\n').encode())
print('PONG sent \n')
if data.find("PRIVMSG") != -1: #some irc actions
final_result = "PRIVMSG...\n"
s.send(final_result.encode())
else:
time.sleep(5) #some irc actions
send_nude = "PRIVMSG Candy !ep1" + "\n"
s.send(send_nude.encode())
time.sleep(0.5)
why does it gives me that UnicodeEncodeError while it runs absolutely fine in anything else ?