Skip to content

Commit 63d9bca

Browse files
committed
added functionality previously seen in PortUtil in html2pdf to TextUtil to accomodate autoporting ease RND-788
1 parent 741b272 commit 63d9bca

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

io/src/main/java/com/itextpdf/io/util/TextUtil.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
4646
import com.itextpdf.io.font.otf.Glyph;
4747
import com.itextpdf.io.font.otf.GlyphLine;
4848

49+
import java.nio.charset.Charset;
4950
import java.util.ArrayList;
5051
import java.util.List;
5152

@@ -248,4 +249,12 @@ public static boolean isNonPrintable(int c) {
248249
public static boolean isWhitespaceOrNonPrintable(int code) {
249250
return Character.isWhitespace(code) || isNonPrintable(code);
250251
}
252+
253+
public static boolean charsetIsSupported(String charsetName) {
254+
try {
255+
return Charset.isSupported(charsetName);
256+
} catch (IllegalArgumentException e) {
257+
return false;
258+
}
259+
}
251260
}

0 commit comments

Comments
 (0)