diff --git a/poppler/Form.cc b/poppler/Form.cc index 00c8cc1..906cb36 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -676,6 +676,7 @@ GooString* FormField::getFullyQualifiedName() { Object parent; GooString *parent_name; GooString *full_name; + GooString *unicode_bom = NULL; if (fullyQualifiedName) return fullyQualifiedName; @@ -688,8 +689,9 @@ GooString* FormField::getFullyQualifiedName() { parent_name = obj2.getString(); if (parent_name->hasUnicodeMarker()) { + unicode_bom = new GooString(parent_name, 2, 0); // Store unicode BOM parent_name->del(0, 2); // Remove the unicode BOM - full_name->insert(0, "\0.", 2); // 2-byte unicode period + full_name->insert(0, "\0.", 2); // 2-byte unicode period } else { full_name->insert(0, '.'); // 1-byte ascii period } @@ -705,7 +707,11 @@ GooString* FormField::getFullyQualifiedName() { parent.free(); if (partialName) { - full_name->append(partialName); + if (partialName->hasUnicodeMarker()) { + full_name->append(partialName->getCString()+2, partialName->getLength()-2); + } else { + full_name->append(partialName); + } } else { int len = full_name->getLength(); // Remove the last period @@ -713,6 +719,11 @@ GooString* FormField::getFullyQualifiedName() { full_name->del(len - 1, 1); } + if (unicode_bom) { + full_name->insert(0, unicode_bom); + delete unicode_bom; + } + fullyQualifiedName = full_name; return fullyQualifiedName; }}