Skip to content

🐛 Preserve Unicode signature metadata in PDF-LIB - #327

Merged
vbuch merged 1 commit into
developfrom
codex/fix-unicode-signature-metadata
Oct 13, 2026
Merged

vbuch merged 1 commit into
developfrom
codex/fix-unicode-signature-metadata

Conversation

@vbuch

@vbuch vbuch commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Fixes #267.

Japanese and other Unicode signature metadata was written with PDFString.of(), which loses characters when serialized. Encode non-ASCII Reason, ContactInfo, Name, and Location values with PDFHexString.fromText() (UTF-16BE with a BOM), while retaining literal strings for ASCII and empty values.

Uses the conditional encoding approach from #292 in a focused change based on current develop. Adds 14 save/reload regressions covering Japanese, accented Latin, Cyrillic, emoji, mixed text, ASCII, and empty strings with object streams both enabled and disabled. Includes rebuilt distribution files.

Validation:

  • All 171 repository tests and repository-wide lint pass.
  • All 29 PDF-LIB tests pass with 100% coverage.
  • Built-package P12 signing smoke test preserves Japanese and emoji metadata and produces a signature whose byte range covers the document.
  • Babel build, declaration generation with --skipLibCheck, and tsd pass.
  • Plain tsc reports errors in installed @types/node declarations (including missing IteratorObject and AsyncIteratorObject); dependency declarations are unchanged by this PR.
  • git diff --check passes.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — codex/fix-unicode-signature-metadata into develop

@vbuch
vbuch merged commit 466b187 into develop Oct 13, 2026
23 checks passed
@vbuch
vbuch deleted the codex/fix-unicode-signature-metadata branch October 13, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Garbled characters when Japanese is used for signature information

2 participants