Repository navigation
Declare UTF-8 in IPTC data written from cloned profiles - #3226
Merged
JimBobSquarePants merged 3 commits intoOct 28, 2026
Merged
Conversation
UpdateData only wrote the 1:90 Coded Character Set dataset when a value's encoding was the Encoding.UTF8 instance. Cloning an IPTC value clones its encoding, so a profile from a cloned image, or a value set with a caller's own UTF8Encoding, was written without the declaration and other readers fell back to Latin-1 for non-ASCII text. The encoding is now matched by code page.
4 tasks done
4 tasks done
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.
Prerequisites
Description
IptcProfile.UpdateDataidentified UTF-8 by comparing encoding object references.DeepClonecopies the encoding object, so cloned profiles lost their UTF-8 character set declaration on save. A separateUTF8Encodinginstance had the same problem. Other readers could then interpret the UTF-8 text with the wrong encoding.The check now compares code pages. UTF-8 values write the existing 1:90 declaration (
ESC % G), including values in cloned profiles. The Latin-1 control checks that its original bytes remain unchanged and no UTF-8 declaration is added. Serialization layout and parsing rules are unchanged.The regressions extend
IptcProfileTests. They check cloned profiles, a separate UTF-8 encoding instance, a cloned Latin-1 value, and repeated image cloning and JPEG saves. The JPEG tests use the existing stored 31×31 PNG input. They check the exact IPTC bytes and decoded caption text, including that repeated saves write only one declaration. The JPEG helper leaves source-image disposal to its caller; each clone has an explicit lifetime.With the original reference comparison, all three UTF-8 regressions fail and the Latin-1 control passes. With the fix, all 215 focused IPTC tests pass in Release on .NET 10 and .NET 11, with no failures or skips. No tolerances, reference images, or public API changed.
V4 backport: #3259.
Fixes #3238