Bug 465144

Summary: Add explicit encoding to python's fileopen
Product: [Applications] kid3 Reporter: Thomas Klausner <wiz>
Component: generalAssignee: Urs Fleisch <ufleisch>
Status: RESOLVED FIXED    
Severity: major    
Priority: NOR    
Version First Reported In: 3.9.x   
Target Milestone: ---   
Platform: NetBSD pkgsrc   
OS: NetBSD   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch fixing the problem.

Description Thomas Klausner 2023-02-01 20:12:54 UTC
Created attachment 155858 [details]
Patch fixing the problem.

With the default C locale on NetBSD, the fixappdata.py script as run in the build reports an error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 305: ordinal not in range(128)

Please apply the attached patch to give fileinput.input() an explicit encoding argument - this fixes the issue.
Comment 1 Urs Fleisch 2023-02-04 07:18:13 UTC
Thanks for the report. The Debian maintainer encountered the same issue, and I came up with the fix https://invent.kde.org/multimedia/kid3/-/commit/cdc47207d2807f47222e904e441f95a523724ed1 treating the file as binary, which is a bit more tolerant than your solution. Is this OK for you too?
I am still wondering why this affects only fixappdata.py, but not fixdesktop.py, and if this is a feature or bug of Python 3.11 (the Debian maintainer made the conclusion that the Python update might be the cause).
Comment 2 Thomas Klausner 2023-02-04 10:42:50 UTC
Thanks for the information - the committed patch works for me.