Fix conversions of Unicode characters above plane 0 (Issue #159)

This commit is contained in:
Michael R Sweet
2026-02-14 09:51:49 -05:00
parent d03e5ee5d9
commit 15f197d030
2 changed files with 2 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ v1.6.2 - YYYY-MM-DD
- Fixed xref reconstruction for objects lacking a `Type` value.
- Fixed `pdfioPageOpenStream` for indirect `Contents` arrays.
- Fixed an error propagation bug when reading too-long values (Issue #146)
- Fixed a bug when converting Unicode characters above plane 0 (issue #159)
- Fixed a Clang warning.

View File

@@ -229,7 +229,7 @@ _pdfio_utf16cpy(
else
{
// 4-byte UTF-8
*dstptr++ = (char)(0xe0 | (ch >> 18));
*dstptr++ = (char)(0xf0 | (ch >> 18));
*dstptr++ = (char)(0x80 | ((ch >> 12) & 0x3f));
*dstptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
*dstptr++ = (char)(0x80 | (ch & 0x3f));