Skip to content

Commit 30369f9

Browse files
author
Benoit Lagae
committed
Add test for Unicode form field names
DEVSIX-1357
1 parent 21a17e7 commit 30369f9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

forms/src/test/java/com/itextpdf/forms/PdfFormFieldTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ public void formFieldTest03() throws IOException, InterruptedException {
130130
}
131131
}
132132

133+
@Test
134+
public void unicodeFormFieldTest() throws IOException {
135+
String filename = sourceFolder + "unicodeFormFieldFile.pdf";
136+
PdfDocument pdfDoc = new PdfDocument(new PdfReader(filename));
137+
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, true);
138+
Map<String, PdfFormField> formFields = form.getFormFields();
139+
byte[] result = {(byte) 0xFE,(byte) 0xFF,(byte) 0x5E,(byte) 0x10,(byte) 0x53,(byte) 0xF7,(byte) 0x00,(byte) 0x31}; // 帐号1: account number 1
140+
Assert.assertArrayEquals(formFields.keySet().toArray()[0].toString().getBytes(), result);
141+
}
142+
133143
@Test
134144
public void choiceFieldTest01() throws IOException, InterruptedException {
135145
String filename = destinationFolder + "choiceFieldTest01.pdf";

0 commit comments

Comments
 (0)