Skip to content

Commit 66a442b

Browse files
Benoit Lagaeyulian-gaponenko
authored andcommitted
Merge branch 'hotfix/unicodeformfield' into develop
Autoported commit. Original commit hash: [65869521f5]
2 parents bbb5a0e + f1054ac commit 66a442b

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

itext.tests/itext.forms.tests/itext/forms/PdfFormFieldTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ public virtual void FormFieldTest03() {
114114
}
115115
}
116116

117+
/// <exception cref="System.IO.IOException"/>
118+
[NUnit.Framework.Test]
119+
public virtual void UnicodeFormFieldTest() {
120+
String filename = sourceFolder + "unicodeFormFieldFile.pdf";
121+
PdfDocument pdfDoc = new PdfDocument(new PdfReader(filename));
122+
PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, true);
123+
IDictionary<String, PdfFormField> formFields = form.GetFormFields();
124+
byte[] result = new byte[] { (byte)0xFE, (byte)0xFF, (byte)0x5E, (byte)0x10, (byte)0x53, (byte)0xF7, (byte
125+
)0x00, (byte)0x31 };
126+
// 帐号1: account number 1
127+
NUnit.Framework.Assert.AreEqual(formFields.Keys.ToArray(new String[1])[0].GetBytes(), result);
128+
}
129+
117130
/// <exception cref="System.IO.IOException"/>
118131
/// <exception cref="System.Exception"/>
119132
[NUnit.Framework.Test]
Binary file not shown.

itext/itext.forms/itext/forms/PdfAcroForm.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,11 +952,11 @@ private IDictionary<String, PdfFormField> IterateFields(PdfArray array, IDiction
952952
parentField = PdfFormField.MakeFormField(parentField.GetParent(), document);
953953
}
954954
}
955-
name = fieldName.ToUnicodeString() + "." + index;
955+
name = fieldName.GetValue() + "." + index;
956956
index++;
957957
}
958958
else {
959-
name = fieldName.ToUnicodeString();
959+
name = fieldName.GetValue();
960960
}
961961
fields.Put(name, formField);
962962
if (formField.GetKids() != null) {

itext/itext.forms/itext/forms/fields/PdfFormField.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,12 +1578,12 @@ public virtual PdfString GetFieldName() {
15781578
());
15791579
PdfString pName = parentField.GetFieldName();
15801580
if (pName != null) {
1581-
parentName = pName.ToUnicodeString() + ".";
1581+
parentName = pName.GetValue() + ".";
15821582
}
15831583
}
15841584
PdfString name = GetPdfObject().GetAsString(PdfName.T);
15851585
if (name != null) {
1586-
name = new PdfString(parentName + name.ToUnicodeString());
1586+
name = new PdfString(parentName + name.GetValue());
15871587
}
15881588
return name;
15891589
}

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
06d69f7cd6a8fb4ae0c78f98244e48c4d4257613
1+
65869521f5572566f566be81ff453c91a286dda1

0 commit comments

Comments
 (0)