jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/390582 )
Change subject: [Bugfix] Do not capitalize ß in first_upper ......................................................................
[Bugfix] Do not capitalize ß in first_upper
Bug: T179115 Change-Id: Iec871eefcbcc28059109d155691f888089c99e0f --- M pywikibot/tools/__init__.py M tests/cosmetic_changes_tests.py 2 files changed, 9 insertions(+), 1 deletion(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved Zoranzoki21: Looks good to me, but someone else must approve
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py index 8f94f77..c3e2d6f 100644 --- a/pywikibot/tools/__init__.py +++ b/pywikibot/tools/__init__.py @@ -450,8 +450,14 @@ Return a string with the first character capitalized.
Empty strings are supported. The original string is not changed. + + Warning: Python 2 and 3 capitalize "ß" differently. MediaWiki does + not capitalize ß at the beginning. See T179115. """ - return string[:1].upper() + string[1:] + first = string[:1] + if first != 'ß': + first = first.upper() + return first + string[1:]
def normalize_username(username): diff --git a/tests/cosmetic_changes_tests.py b/tests/cosmetic_changes_tests.py index 83d2c4e..6900b3e 100644 --- a/tests/cosmetic_changes_tests.py +++ b/tests/cosmetic_changes_tests.py @@ -316,6 +316,8 @@ self.cct.cleanUpLinks('[[sand|sand]]box')) self.assertEqual('[[Sand|demospace]]', self.cct.cleanUpLinks('[[sand|demo]]space')) + self.assertEqual('[[ß|Eszett]]', + self.cct.cleanUpLinks('[[ß|Eszett]]')) self.assertEqual('[[Title]]', self.cct.cleanUpLinks('[[title|Title]]')) self.assertEqual('[[Sand]]box',
pywikibot-commits@lists.wikimedia.org