i use chat plugin and i have this problem
[21:22:52] Python Error: ‘charmap’ codec can’t encode character ‘\u0131’ in position 40: character maps to
?
i use chat plugin and i have this problem
[21:22:52] Python Error: ‘charmap’ codec can’t encode character ‘\u0131’ in position 40: character maps to
?
Have to learn some Python. There’s an encoding error somewhere.
this is the plugin
from phBot import *
import phBotChat
import datetime
def handle_chat(t,player,msg):
type = ‘None’
if t == 2:
type = ‘(Private)’
if t == 9:
type = ‘(Stall)’
if type != ‘None’:
file = open(“Log/”+get_character_data()[‘server’]+"_"+get_character_data()[‘name’]+"_ChatLog.txt",“a”)
date = datetime.datetime.now().strftime("%d-%m-%Y %H:%M:%S")
file.write(’[’+date+’]’+type+player+’: ‘+msg+’\n’)
file.close()
log(’[%s] Loaded’ % name)
what should i do ?
You probably have to encode the message to UTF-8 before saving it.
Edit: or open the file with UTF-8 encoding.
which file ? py ?
Give it a try! Maybe you like it …