Currently Mail Helper does not support non-ascii names. "Sirmen K谋z谋lcan" would fail on a last name subsitution.
Hi @iamgollum,
Thanks for the heads up! We will investigate.
Hi @iamgollum
Was taking a look at the issue you were experiencing, and it's definitely a bit annoying to constantly need to encode Python 2.7 strings, which are by default in ASCII, to UTF-8.
It would be great if the helper methods would enforce encoding based on Python version, but in the meantime if you need to continue using the SendGrid library w/ Python 2.7 you can try inserting:
#!/usr/bin/python
# -*- coding: utf-8 -*-
at the beginning of your .py file that's sending mail. Within most code editors (I tested on Vim), this will safely change the default encoding to UTF-8 when the file is executed. This allowed me to send mail with the substitution value "K谋z谋lcan" without issue.
@LiYChristopher Thank you sir. I will try this out this weekend. Much appreciated!
@iamgollum I encountered a similar error, and recently made a small code tweak to address this issue with unicode characters being used in Substitutions. Can you update your version of SendGrid and see if the issue still exists? I think it should not be a problem any more.
Most helpful comment
Hi @iamgollum
Was taking a look at the issue you were experiencing, and it's definitely a bit annoying to constantly need to encode Python 2.7 strings, which are by default in ASCII, to UTF-8.
It would be great if the helper methods would enforce encoding based on Python version, but in the meantime if you need to continue using the SendGrid library w/ Python 2.7 you can try inserting:
at the beginning of your .py file that's sending mail. Within most code editors (I tested on Vim), this will safely change the default encoding to UTF-8 when the file is executed. This allowed me to send mail with the substitution value
"K谋z谋lcan"without issue.