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


--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/774862
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I58180ea163c2b376b5944f354912a1162bd45d02
Gerrit-Change-Number: 774862
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: D3r1ck01 <[email protected]>
Gerrit-Reviewer: Rubin <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to