Skip to content

Handle encoding issues in loading credits.html#4015

Open
llimeht wants to merge 1 commit into
SasView:release_6.2.0from
llimeht:tmp/credits-encoding
Open

Handle encoding issues in loading credits.html#4015
llimeht wants to merge 1 commit into
SasView:release_6.2.0from
llimeht:tmp/credits-encoding

Conversation

@llimeht

@llimeht llimeht commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Description

Be defensive against non-UTF-8 chars that can creep into credits.html since it is compiled from lots of different sources, and force use of UTF-8 since the file should already be UTF-8 via pip-licenses and build_tools/compile_licenses.py.

This PR

  • forces use of UTF-8 for credits.html since that is what it should be, working around the on-going obsession windows has with cp1252 (as spotted in the traceback in Credits and Licences throws error #4013) ... bring on Python 3.15 for that to finally change.
  • makes reading credits.html robust against malformed data by using replacement characters where it needs to, in order to ensure it can decode from UTF-8.
  • switches loading credits.html to the established code path within system.legal
  • fixes a latent bug in the credits_html function (function is not used elsewhere in the code bae)

Fixes #4013

How Has This Been Tested?

Tested locally on linux (but note that this is a windows-specific bug due to it still using cp1252):

. .venv/bin/activate
python build_tools/compile_licenses.py src/sas/system/credits.html
sasview

Have not tested from the installer because generating installer images has been disabled in CI.

Note that unrelated failing test on linux is #4000 which is waiting for PRs to be merged to fix.

Review Checklist:

[if using the editor, use [x] in place of [ ] to check a box]

Documentation (check at least one)

  • There is nothing that needs documenting
  • Documentation changes are in this PR
  • There is an issue open for the documentation (link?)

Installers

  • There is a chance this will affect the installers, if so
    • Windows installer (GH artifact) has been tested (installed and worked)
    • MacOSX installer (GH artifact) has been tested (installed and worked)
    • Wheels installer (GH artifact) has been tested (installed and worked)

Licensing (untick if necessary)

  • The introduced changes comply with SasView license (BSD 3-Clause)

@krzywon krzywon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Seems like this should help to fix the issue, but I haven't tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants