Skip to content
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

Unicode email address helper #40316

Closed
zenzen mannequin opened this issue May 31, 2004 · 6 comments
Closed

Unicode email address helper #40316

zenzen mannequin opened this issue May 31, 2004 · 6 comments
Assignees
Labels
stdlib Python modules in the Lib dir topic-unicode type-feature A feature request or enhancement

Comments

@zenzen
Copy link
Mannequin

zenzen mannequin commented May 31, 2004

BPO 963906
Nosy @loewis, @merwok, @bitdancer
Files
  • EmailAddress.py
  • test_EmailAddress.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/bitdancer'
    closed_at = <Date 2011-04-06.14:18:22.944>
    created_at = <Date 2004-05-31.23:36:08.000>
    labels = ['type-feature', 'library', 'expert-unicode']
    title = 'Unicode email address helper'
    updated_at = <Date 2011-04-06.14:18:22.943>
    user = 'https://bugs.python.org/zenzen'

    bugs.python.org fields:

    activity = <Date 2011-04-06.14:18:22.943>
    actor = 'r.david.murray'
    assignee = 'r.david.murray'
    closed = True
    closed_date = <Date 2011-04-06.14:18:22.944>
    closer = 'r.david.murray'
    components = ['Library (Lib)', 'Unicode']
    creation = <Date 2004-05-31.23:36:08.000>
    creator = 'zenzen'
    dependencies = []
    files = ['6006', '6007']
    hgrepos = []
    issue_num = 963906
    keywords = ['patch']
    message_count = 6.0
    messages = ['46105', '46106', '46107', '46108', '110565', '133134']
    nosy_count = 4.0
    nosy_names = ['loewis', 'zenzen', 'eric.araujo', 'r.david.murray']
    pr_nums = []
    priority = 'normal'
    resolution = 'remind'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue963906'
    versions = ['Python 3.3']

    @zenzen
    Copy link
    Mannequin Author

    zenzen mannequin commented May 31, 2004

    Converting email addresses between Unicode and ASCII is non
    trivial, as three different encodings are used (RFC2047, IDNA and
    ASCII). Here is an EmailAddress I use and a test suite, which I feel
    should be integrated into the email package. I'm quite happy to
    implement a different interface if the 'unicode subclass' design is
    unsuitable, although I got no feedback from the Email-SIG so they
    are either happy with it or asleep ;)

    @zenzen zenzen mannequin added stdlib Python modules in the Lib dir labels May 31, 2004
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Aug 25, 2004

    Logged In: YES
    user_id=21627

    I think it is inappropriate to create new API for this.
    Instead, one of the many functions that already deal with
    address parsing need to be enhanced. For example,
    email.Util.formataddr should learn to format unicode
    strings, too. Likewise, parseaddr could grow a parameter
    do_unicode, or a second function parseaddr_unicode could be
    added. There is IMO no need for a new class.

    In addition, this patch lacks documentation and test cases.

    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Aug 25, 2004

    Logged In: YES
    user_id=21627

    Oops, test cases are there - only documentation is lacking.

    @zenzen
    Copy link
    Mannequin Author

    zenzen mannequin commented Sep 7, 2004

    Logged In: YES
    user_id=46639

    I think that adding options to the existing APIs simply makes the Unicode
    support feel tacked on (as it would be). It is also error prone, where if
    you are following best practice and using Unicode everywhere, you have
    to remember to explicitly pass the 'do_unicode=True' parameter to this
    one particular function.

    I think the alternative approach would be to use a codec, similar to how
    Unicode DNS domains are handled
    ('foo@example.com'.decode('emailaddress')).

    I still prefer the OO approach though, as it allows the programmer to
    treat email addresses as a standard Unicode string with a few extra
    features, such as the __cmp__ method I've since added to
    EmailAddress.py and the test suite:

    >>> e = EmailAddress(u'renee@ol\u00e9.de', u'Rene\u00e9 Acut\u00e9')
    >>> e == str(e)
    True
    >>> e == unicode(e)
    True
    >>> e == str(EmailAddress(e.upper()))
    True
    >>> e == unicode(EmailAddress(e.upper()))
    True

    @devdanzin devdanzin mannequin added topic-unicode type-feature A feature request or enhancement labels Feb 14, 2009
    @bitdancer
    Copy link
    Member

    I'm assigning this to myself so I don't lose it. I'll need to incorporate the intent of the tests and logic into email6. And yes I set 3.3 on purpose...email6 won't be in 3.2 and I don't want to spend the cycles figuring out whether this would work in email5 (the 3.2 version of email).

    @bitdancer
    Copy link
    Member

    bpo-1690608 addresses part of this issue, and bpo-11783 will address the IDNA part.

    From my point of view those two issues solve this problem from the perspective the email package infrastructure and *current* API. In the email6 API I do plan to have an address helper class that will make managing addresses more conveniently OO, but that is part of the whole email6 process and I don't feel a need any longer to keep this issue open. There's no good value for 'resolution' to express the resolution here (I've accepted the idea but not the code), so I used 'remind', since I will be coming back to the idea in a little while.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir topic-unicode type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant