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

Inconsistent behavior of non-ascii handling in EmailPolicy.fold #77749

Closed
Licht-T mannequin opened this issue May 18, 2018 · 1 comment
Closed

Inconsistent behavior of non-ascii handling in EmailPolicy.fold #77749

Licht-T mannequin opened this issue May 18, 2018 · 1 comment
Labels
3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@Licht-T
Copy link
Mannequin

Licht-T mannequin commented May 18, 2018

BPO 33568
Nosy @Licht-T
PRs
  • gh-77749: Fix inconsistent behavior of non-ascii handling in EmailPolicy.fold #6986
  • 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 = None
    closed_at = None
    created_at = <Date 2018-05-18.12:12:02.444>
    labels = ['3.7', '3.8', 'type-bug', 'library']
    title = 'Inconsistent behavior of non-ascii handling in EmailPolicy.fold'
    updated_at = <Date 2018-05-19.15:07:13.931>
    user = 'https://github.com/Licht-T'

    bugs.python.org fields:

    activity = <Date 2018-05-19.15:07:13.931>
    actor = 'licht-t'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2018-05-18.12:12:02.444>
    creator = 'licht-t'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33568
    keywords = ['patch']
    message_count = 1.0
    messages = ['317025']
    nosy_count = 1.0
    nosy_names = ['licht-t']
    pr_nums = ['6986']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue33568'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']

    Linked PRs

    @Licht-T
    Copy link
    Mannequin Author

    Licht-T mannequin commented May 18, 2018

    policy.utf8 is False, but non-ascii are not well-handled.
    Repro. code.

    Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19) 
    [GCC 7.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from email.message import EmailMessage
    >>> from email.policy import default
    >>> 
    >>> policy = default.clone()
    >>> policy.utf8
    False
    >>> msg = EmailMessage()
    >>> msg["Subject"] = "á"
    >>> policy.fold("Subject", msg["Subject"])
    'Subject: =?utf-8?q?=C3=A1?=\n'
    >>> policy.fold("Subject", 'á')
    'Subject: á\n'
    

    @Licht-T Licht-T mannequin added 3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels May 18, 2018
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    serhiy-storchaka added a commit that referenced this issue Jan 26, 2024
    …icy.fold() (GH-6986)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 26, 2024
    …ailPolicy.fold() (pythonGH-6986)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    (cherry picked from commit 504334c)
    
    Co-authored-by: Rito Takeuchi <licht-t@outlook.jp>
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 26, 2024
    …ailPolicy.fold() (pythonGH-6986)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    (cherry picked from commit 504334c)
    
    Co-authored-by: Rito Takeuchi <licht-t@outlook.jp>
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    serhiy-storchaka added a commit that referenced this issue Jan 26, 2024
    …mailPolicy.fold() (GH-6986) (GH-114606)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    (cherry picked from commit 504334c)
    
    Co-authored-by: Rito Takeuchi <licht-t@outlook.jp>
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    serhiy-storchaka added a commit that referenced this issue Jan 26, 2024
    …mailPolicy.fold() (GH-6986) (GH-114607)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    (cherry picked from commit 504334c)
    
    Co-authored-by: Rito Takeuchi <licht-t@outlook.jp>
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
    …ailPolicy.fold() (pythonGH-6986)
    
    It now always encodes non-ASCII characters in headers if utf8 is false.
    
    Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants
    @serhiy-storchaka and others