/
/
# What does this implement/fix? When we fetch a remote playlist or stream, we honour the character set the server declares in its headers. We only checked that the name was one Python knows, which isn't the same as it being usable for reading text — a handful of names pass that check but can't decode text at all, and would then fail at the moment we tried to read the playlist. We now accept a declared character set only if it can actually decode text, and otherwise fall back to detecting it from the content, which is what already happens for made-up or misspelled names. That also makes the error handling around the playlist read redundant, so it's gone. ## Types of changes - [ ] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [x] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` Changes: - `detect_charset` now validates a declared charset by trying it, instead of only looking up the name - Dropped the now-redundant decode error handler in `fetch_playlist` - Added tests covering charset names that resolve to a codec but can't decode text ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.