Fix composer names with accented characters showing as "Unknown"#4
Open
eeksock wants to merge 1 commit into
Open
Fix composer names with accented characters showing as "Unknown"#4eeksock wants to merge 1 commit into
eeksock wants to merge 1 commit into
Conversation
SID header text fields (title/author) are nominally ASCII, but decades of HVSC files use Latin-1 for accented composer names - e.g. Chris Hulsbeck's author field is literally "Chris H" + 0xFC + "lsbeck", where 0xFC is the Latin-1 byte for u-umlaut. stringWithUTF8String: (used for the Now Playing bar and Control Center) returns nil for the whole string when it hits a byte that isn't valid UTF-8, which is exactly what a lone Latin-1 high-bit byte is - so the author fell back to "Unknown" even though the track list already showed the name correctly via a separate, more lenient code path. Decode SID header text by trying UTF-8 first and falling back to Latin-1 if that fails, and share this logic across all three places that read title/author bytes (playSIDFile, authorFromFile, and the table view's cell renderer, which had its own inline duplicate of authorFromFile that was never actually calling it). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Accented characters, like Chris Hülsbeck, weren't displaying properly in the Now Playing bar and the control center, and showed up as "Unknown" instead.
SID header text fields (title/author) are nominally ASCII, but decades of HVSC files use Latin-1 for accented composer names - e.g. Chris Hulsbeck's author field is literally "Chris H" + 0xFC + "lsbeck", where 0xFC is the Latin-1 byte for u-umlaut.
stringWithUTF8String:(used for the Now Playing bar and Control Center) returns nil for the whole string when it hits a byte that isn't valid UTF-8, which is exactly what a lone Latin-1 high-bit byte is - so the author fell back to "Unknown" even though the track list already showed the name correctly via a separate, more lenient code path.This decodes SID header text by trying UTF-8 first and falling back to Latin-1 if that fails, and shares this logic across all three places that read title/author bytes (
playSIDFile,authorFromFile, and the table view's cell renderer, which had its own inline duplicate ofauthorFromFilethat was never actually calling it).