From 842ec075de3b43a8de8010028dc69b834e2ca60f Mon Sep 17 00:00:00 2001 From: Cristy Date: Thu, 28 Mar 2019 19:52:22 -0400 Subject: [PATCH] https://imagemagick.org/discourse-server/viewtopic.php?t=35741 --- coders/pdf.c | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/coders/pdf.c b/coders/pdf.c index 4ed397549..77c90eb06 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -2973,11 +2973,35 @@ RestoreMSCWarning utf16=ConvertUTF8ToUTF16((unsigned char *) basename,&length); if (utf16 != (wchar_t *) NULL) { - (void) FormatLocaleString(buffer,MagickPathExtent,"/Title (\xfe\xff"); + unsigned char + hex_digits[16]; + + hex_digits[0]='0'; + hex_digits[1]='1'; + hex_digits[2]='2'; + hex_digits[3]='3'; + hex_digits[4]='4'; + hex_digits[5]='5'; + hex_digits[6]='6'; + hex_digits[7]='7'; + hex_digits[8]='8'; + hex_digits[9]='9'; + hex_digits[10]='A'; + hex_digits[11]='B'; + hex_digits[12]='C'; + hex_digits[13]='D'; + hex_digits[14]='E'; + hex_digits[15]='F'; + (void) FormatLocaleString(buffer,MagickPathExtent,"/Title > 4) & 0x0f]); + (void) WriteBlobByte(image,hex_digits[utf16[i] & 0x0f]); + } + (void) FormatLocaleString(buffer,MagickPathExtent,">\n"); utf16=(wchar_t *) RelinquishMagickMemory(utf16); } } -- 2.40.0