Page MenuHomePhabricator

comms.http._decide_encoding sometimes fails to detect encodings
Closed, ResolvedPublicBUG REPORT

Description

comms.http._decide_encoding sometimes gives a warning like WARNING: Unknown or invalid encoding 'ISO-8859-1,utf-8;q=0.7,*;q=0.7' and returns None because encodings detection fails but it could detect encoding easily because 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'` contains multiple encodings separated by comma and with quality factor which is 1 by default. The given string has the following encodings:

  1. ISO-8859-1 (quality 1.0)
  2. utf-8 (quality 0.7)
  3. * = wildcard for other encodings (quality 0.7)

Details

Event Timeline

Xqt triaged this task as Medium priority.Apr 20 2025, 2:22 PM
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt changed the task status from Open to In Progress.Apr 20 2025, 3:50 PM

Change #1137561 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] [bugfix] Retieve charset from accept-charset header entry

https://gerrit.wikimedia.org/r/1137561

Change #1137561 merged by jenkins-bot:

[pywikibot/core@master] [bugfix] Retieve charset from accept-charset header entry

https://gerrit.wikimedia.org/r/1137561