Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dict key normalization can trigger "key value cannot be read" errors #97

Open
petervwyatt opened this issue Aug 13, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@petervwyatt
Copy link
Member

Due to TestGrammar PoC needing to do dictionary key normalization (via key sorting, so that all PDF libraries process keys in the same order so output is deterministic and independent of PDF library), under certain rare but specific conditions this can result in "key value cannot be read" errors since the normalized key name is not the same as the PDF. This appears to occur when the name uses multiple adjacent # hex codes - and likely where the PDF library is assuming it is UTF-8 when it is not. Most PDF libraries hide any # hex codes so the key name returned is whatever C/C++ type the library chooses and how they map back to a key inside the PDF (with appropriate hex codes) is a mystery...

A possible solution is for the Arlington PDF wrapper to store both the "raw" key name returned/used by the PDF SDK (in whatever format it uses), as well as the normalized version used by TestGrammar PoC for sorting (std::wstring).

@petervwyatt petervwyatt added this to the TestGrammar C++ PoC milestone Aug 13, 2023
@petervwyatt petervwyatt self-assigned this Aug 13, 2023
@petervwyatt petervwyatt added the bug Something isn't working label Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant