Skip to content

Mail helper library breaks with unicode recipient names #334

Closed

Description

@openly-retro

I encountered an issue using the helper library to send mails to recipients with unicode first name / last name:

File "/usr/local/lib/python2.7/dist-packages/sendgrid/helpers/mail/mail.py", line 379, in __init__ self.value = value
File "/usr/local/lib/python2.7/dist-packages/sendgrid/helpers/mail/mail.py", line 395, in value self._value = str(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)

self._value = str(value)

Setting the encoding of the python document to utf-8 does not resolve/affect this issue. The code is converting unicode values to ascii.

Activity

  1. thinkingserious commented on Aug 17, 2017

    @thinkingserious
    Contributor

    Thanks for the heads up. I've added this to our backlog.

    For my own reference, I think this should do the trick: self._value = str(value).encode('utf-8')

    For this issue to gain priority in our backlog, we need additional +1's or a PR. When we receive a PR, that provides the biggest jump in priority.

  2. thinkingserious commented on Aug 17, 2017

    @thinkingserious
    Contributor

    @mehronkugler,

    Do you mind providing some sample content that is causing the breakage? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions