-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding UTF-8 #42
Comments
Here's a couple things to try. Check your Python version. I expect Python 3. $ python --version Check the encoding of the template. I expect UTF-8. $ file mailmerge_template.txt |
anything else that i should try? :( |
Digging a little deeper, it looks like this is not related to actually sending the message. On my machine, I get the expected output at the terminal. $ python3 --version
Python 3.7.2
$ file mailmerge_*
mailmerge_database.csv: ASCII text
mailmerge_server.conf: ASCII text
mailmerge_template.txt: HTML document text, UTF-8 Unicode text
$ mailmerge
>>> message 0
TO: myself@mydomain.com
SUBJECT: Testing mailmerge
FROM: My Self <myself@mydomain.com>
Content-Type: text/html; charset="utf-8"
<!doctype html>
<html lang="pt-br">
<head>
<title> Page title </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style type="text/css">
* {
margin: 0;
border: 0;
padding: 0;
color: red;
font-family: Arial, Helvetica, sans-serif;
}
</style>
</head>
<body>
<h1>ççç ÇÇÇ áéíóú !.</h1>
</body>
</html>
>>> encoding utf-8
>>> sent message 0 DRY RUN
>>> Limit was 1 messages. To remove the limit, use the --no-limit option.
>>> This was a dry run. To send messages, use the --no-dry-run option. Next thing to check is the file encoding of the database. |
mailmerge_database.csv: ASCII text, with CRLF line terminators |
That looks OK to me. Next thing to try: use the smallest email you can to try and reproduce the bug. Something like this: mailmerge_template.txt
|
mailmerge_template.txt
Output
Message in my inbox: |
Let's try it without mailmerge, just with Python.
Edit print("ççç ÇÇÇ áéíóú") Now run it. $ file test.py
test.py: UTF-8 Unicode text
$ python3 test.py
ççç ÇÇÇ áéíóú |
|
Well, looks like that's not it. Is $ which mailmerge
/usr/local/bin/mailmerge
$ head /usr/local/bin/mailmerge
#!/usr/local/opt/python/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys
from mailmerge.__main__ import cli
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(cli()) |
Anaconda CondaEnv Python 3.7.3
That's weird o_o |
Mailmerge works with either Python2 or Python3. Next thing to try: let's see if Anaconda is causing a problem. We'll install mailmerge from source, using the absolute path to a non-Anaconda python executable. If you're on Windows, use WSL or Cygwin. If you're on OSX, use homebrew to install Python. Make sure that your Python executable is not Anaconda. Make sure that PYTHONPATH is not set. $ which python3
/usr/local/bin/python3
$ echo $PYTHONPATH
# <blank> Get the source code $ git clone https://github.com/awdeorio/mailmerge.git
Cloning into 'mailmerge'... Install using the absolute path to Python 3. Install virtual environment with a local copy of pip. $ /usr/local/bin/python3 -m venv venv
$ source venv/bin/activate
$ which pip
/Users/awdeorio/Downloads/mailmerge/venv/bin/pip
$ pip install -e . Verify that you have a local copy of mailmerge installed. $ which mailmerge
/Users/awdeorio/Downloads/mailmerge/venv/bin/mailmerge
$ mailmerge --version
mailmerge, version 1.9 Now, try your test again. |
Looks like this issue has gone stale. Please reopen if you have more information! |
mailmerge_template.txt
Terminal:
Recieved mail:
Am i doing anything wrong? What should i do to those characters appears?
The text was updated successfully, but these errors were encountered: