Skip to content

Commit b11db3f

Browse files
committed
Set PdfString encoding to UTF-16 in PdfAnnotation#setContents(String) so that complex strings are encoded properly
1 parent 5ad7223 commit b11db3f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/annot/PdfAnnotation.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ This file is part of the iText (R) project.
4343
*/
4444
package com.itextpdf.kernel.pdf.annot;
4545

46+
import com.itextpdf.io.font.PdfEncodings;
4647
import com.itextpdf.kernel.color.Color;
4748
import com.itextpdf.kernel.geom.Rectangle;
4849
import com.itextpdf.kernel.pdf.PdfArray;
@@ -405,7 +406,7 @@ public PdfAnnotation setContents(PdfString contents) {
405406
* @return this {@link PdfAnnotation} instance.
406407
*/
407408
public PdfAnnotation setContents(String contents) {
408-
return setContents(new PdfString(contents));
409+
return setContents(new PdfString(contents, PdfEncodings.UNICODE_BIG));
409410
}
410411

411412
/**

0 commit comments

Comments
 (0)