awdeorio / mailmerge

A simple, command line mail merge tool.
MIT License
140 stars 41 forks source link

German umlauts not supported #12

Closed tobiashort closed 7 years ago

tobiashort commented 7 years ago

Traceback (most recent call last): File "/usr/bin/mailmerge", line 11, in load_entry_point('mailmerge==1.7.0', 'console_scripts', 'mailmerge')() File "/usr/lib/python3.6/site-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/lib/python3.6/site-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/lib/python3.6/site-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3.6/site-packages/click/core.py", line 535, in invoke return callback(args, **kwargs) File "/usr/lib/python3.6/site-packages/mailmerge/main.py", line 230, in main sendmail(message, config_filename) File "/usr/lib/python3.6/site-packages/mailmerge/main.py", line 71, in sendmail smtp.send_message(message) File "/usr/lib/python3.6/smtplib.py", line 962, in send_message g.flatten(msg_copy, linesep='\r\n') File "/usr/lib/python3.6/email/generator.py", line 116, in flatten self._write(msg) File "/usr/lib/python3.6/email/generator.py", line 181, in _write self._dispatch(msg) File "/usr/lib/python3.6/email/generator.py", line 214, in _dispatch meth(msg) File "/usr/lib/python3.6/email/generator.py", line 432, in _handle_text super(BytesGenerator,self)._handle_text(msg) File "/usr/lib/python3.6/email/generator.py", line 249, in _handle_text self._write_lines(payload) File "/usr/lib/python3.6/email/generator.py", line 155, in _write_lines self.write(line) File "/usr/lib/python3.6/email/generator.py", line 406, in write self._fp.write(s.encode('ascii', 'surrogateescape')) UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 15: ordinal not in range(128)

awdeorio commented 7 years ago

Might you upload the mailmerge_template and mailmerge_database files that generated the error? That would help me reproduce and fix it.

tobiashort commented 7 years ago

mailmerge_template.txt Huh, fast answer, nice. Here you have the template. The database I cannot give you due to data privacy. I see the issue in the umlauts ü, ä and ö Those characters are not in the ascii charset. They are in the latin-1 charset though.

awdeorio commented 7 years ago

I'm working on a permanent fix. In the meantime, a workaround is to use Python 3, which is 100% unicode.

First, remove your old install of mailmerge:

pip uninstall mailmerge

Then, install the Python 3 version of mailmerge:

pip3 install mailmerge