Skip to content

string method .upper() converts 'ß' to 'SS' instead of 'ẞ' #79109

Closed

Description

@MarcRichter
BPO 34928
Nosy @stevendaprano, @tirkarthi
Superseder
  • bpo-30810: Germany made the upper case ß official. 'ß'.upper() should now return ẞ.
  • 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 = <Date 2018-10-08.10:30:57.948>
    created_at = <Date 2018-10-08.09:49:32.424>
    labels = ['interpreter-core', '3.8', 'type-bug', '3.7']
    title = "string method .upper() converts '\xc3\x9f' to 'SS' instead of '\xe1\xba\x9e'"
    updated_at = <Date 2018-10-08.10:30:57.947>
    user = 'https://bugs.python.org/MarcRichter'

    bugs.python.org fields:

    activity = <Date 2018-10-08.10:30:57.947>
    actor = 'xtreak'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-10-08.10:30:57.948>
    closer = 'xtreak'
    components = ['Interpreter Core']
    creation = <Date 2018-10-08.09:49:32.424>
    creator = 'Marc Richter'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34928
    keywords = []
    message_count = 5.0
    messages = ['327336', '327337', '327338', '327339', '327340']
    nosy_count = 3.0
    nosy_names = ['steven.daprano', 'Marc Richter', 'xtreak']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '30810'
    type = 'behavior'
    url = 'https://bugs.python.org/issue34928'
    versions = ['Python 2.7', 'Python 3.4', 'Python 3.5', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    Activity

    1. MarcRichter commented on Oct 8, 2018

      MarcRichtermannequin
      MannequinAuthor

      There's a special letter in German orthography called "eszett" (ß). This letter had no uppercase variant for hundreds of years until 2017, there was an uppercase variant added to the official German orthography called "capital eszett" (ẞ) 1.

      Python's .upper() string method still translates this to "SS" (which was correct before 2017):

      ~ $ python3.7.0
      Python 3.7.0 (default, Aug 29 2018, 17:15:17) 
      [GCC 5.4.0 20160609] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> 'gruß'.upper()
      'GRUSS'
      >>>

      The result of this example should have been 'GRUẞ' instead.
      That being said, it's fair to inform about the fact that this letter is still quite unpopular in Germany; it is not even typeable with German keyboards, yet. Anyways, I think since this became officials orthography, it's not Python's job to adopt behaviors but clear rules instead.

      I'm not sure if this affects .casefold() as well, since I do not get that method's scope.

      BR,
      Marc Richter

    2. added
      3.7 (EOL)
      3.8 (EOL)
      interpreter-core
      type-bug
      on Oct 8, 2018
    3. stevendaprano commented on Oct 8, 2018

      @stevendaprano
      Member

      We match the Unicode specification, not arbitrary language rules. (Austrian and Swiss German are, I believe, phasing out ß altogether, and haven't added an uppercase variant.)

      Until the Unicode consortium change their case conversion rules, it is still correct for .upper() to convert 'ß' to 'SS'. The eszett is just one of the many annoying anomalies in case conversion, like Turkish dotted and dotless i. Natural language is hard, and messy.

      http://unicode.org/faq/casemap_charprop.html

    4. tirkarthi commented on Oct 8, 2018

      @tirkarthi
      Member

      Thanks for the report and details but I think this exact case was already discussed in bpo-30810.

    5. MarcRichter commented on Oct 8, 2018

      MarcRichtermannequin
      MannequinAuthor

      Sorry then; that did not show up in my search :/
      Yes, seems like this is duplicating that one.

    6. tirkarthi commented on Oct 8, 2018

      @tirkarthi
      Member

      No problem. Thanks for the confirmation I am closing this as a duplicate.

    7. transferred this issue fromon Apr 10, 2022
    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

      3.7 (EOL)3.8 (EOL)interpreter-coretype-bug

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions