Fixing encoding annoyance
This commit is contained in:
parent
0a17682054
commit
1f98eb0d46
|
@ -19,7 +19,13 @@ os.chdir(my_dir)
|
||||||
|
|
||||||
|
|
||||||
def join_first_items(item_list):
|
def join_first_items(item_list):
|
||||||
return ''.join([item[0] for item in item_list])
|
result_list = []
|
||||||
|
for item in item_list:
|
||||||
|
if type(item[0]) is bytes:
|
||||||
|
result_list.append(item[0].decode('utf-8'))
|
||||||
|
elif type(item[0]) is str:
|
||||||
|
result_list.append(item[0])
|
||||||
|
return ''.join(result_list)
|
||||||
|
|
||||||
# original_headers = Parser().parsestr(sys.stdin.read())
|
# original_headers = Parser().parsestr(sys.stdin.read())
|
||||||
with open('email1.txt') as fp:
|
with open('email1.txt') as fp:
|
||||||
|
@ -81,11 +87,9 @@ if len(rows) == 0:
|
||||||
cursor.close()
|
cursor.close()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
# Prepare and send the email
|
# Prepare and send the email
|
||||||
syslog.syslog('Sending recruiter autoreply to %s' % decoded_from)
|
syslog.syslog('Sending recruiter autoreply to %s' % decoded_from)
|
||||||
|
|
||||||
|
|
||||||
msg = MIMEMultipart('alternative')
|
msg = MIMEMultipart('alternative')
|
||||||
msg['Subject'] = 'Re: %s' % decoded_subject
|
msg['Subject'] = 'Re: %s' % decoded_subject
|
||||||
msg['From'] = decoded_to
|
msg['From'] = decoded_to
|
||||||
|
|
Loading…
Reference in New Issue