From 15285cbb46d05f3a0a70c4e8b3ec415115d94e07 Mon Sep 17 00:00:00 2001 From: Marek Kasik Date: Mon, 22 Jun 2015 15:53:34 +0200 Subject: [PATCH] Save Unicode strings as hexadecimal strings Save strings with Unicode marker as hexadecimal strings when saving document. --- poppler/PDFDoc.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 71a1efe..d51a428 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1070,15 +1070,11 @@ void PDFDoc::writeString (GooString* s, OutStream* outStr, Guchar *fileKey, if (s->hasUnicodeMarker()) { //unicode string don't necessary end with \0 const char* c = s->getCString(); - outStr->printf("("); + outStr->printf("<"); for(int i=0; igetLength(); i++) { - char unescaped = *(c+i)&0x000000ff; - //escape if needed - if (unescaped == '(' || unescaped == ')' || unescaped == '\\') - outStr->printf("%c", '\\'); - outStr->printf("%c", unescaped); + outStr->printf("%02x", *(c+i)&0x000000ff); } - outStr->printf(") "); + outStr->printf("> "); } else { const char* c = s->getCString(); outStr->printf("("); -- 2.4.3