jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/774862 )
Change subject: [bugfix] Fix cp encodings in reflinks.py ......................................................................
[bugfix] Fix cp encodings in reflinks.py
Bug: T304830 Change-Id: I58180ea163c2b376b5944f354912a1162bd45d02 --- M scripts/reflinks.py 1 file changed, 4 insertions(+), 2 deletions(-)
Approvals: D3r1ck01: Looks good to me, but someone else must approve Rubin: Looks good to me, but someone else must approve Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/reflinks.py b/scripts/reflinks.py index f4aa58e..b87180f 100755 --- a/scripts/reflinks.py +++ b/scripts/reflinks.py @@ -562,10 +562,12 @@ if enc: # Use encoding if found. Else use chardet apparent encoding encoding = enc.group('enc').strip('"' ').lower() - naked = re.sub(r'[ _-]', '', encoding) # Convert to python correct encoding names - if naked == 'xeucjp': + if re.sub(r'[ _-]', '', encoding) == 'xeucjp': encoding = 'euc_jp' + else: + # fix cp encodings (T304830) + encoding = re.sub(r'\Acp[ _-](\d{3,4})', r'cp\1', encoding) return encoding return None
pywikibot-commits@lists.wikimedia.org