Fix EXIF UserComment decoding across current and legacy encodings#359
Open
aladin7 wants to merge 1 commit into
Open
Fix EXIF UserComment decoding across current and legacy encodings#359aladin7 wants to merge 1 commit into
aladin7 wants to merge 1 commit into
Conversation
Owner
|
It still returns question marks when I attempt to test it manually. From debugging, it hits the |
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.
Fixes #324.
Root cause
GetUserCommentdecoded the complete EXIF value as ASCII, including its eight-byte character-code marker. That discarded ASCII comments and corrupted non-ASCII text. A single UTF-16LE assumption is also insufficient: Exif 3.x definesUNICODEcomments as UTF-8, while older files in the wild use UTF-16 with BOM, little-endian, or big-endian byte order.Magick.NET additionally normalizes an EXIF profile's TIFF byte order on first tag access. UserComment therefore has to be decoded before other tags when legacy text has no BOM or byte-pattern clue.
Changes
UNICODEcomments as strict UTF-8.This also addresses the Chinese-text failure reported while reviewing #353.
Validation
dotnet build PicView.Avalonia.Win32/PicView.Avalonia.Win32.csproj --no-restore -p:Platform=x64— succeeded with 0 errors.ExifViewModel.UpdateExifValuespath passed.中文.The repository's full test project currently has unrelated compilation failures in existing navigation mocks (
IImageCache,IArchiveService, andIPlatformSpecificService), so it cannot reach test execution on currentdev.