Skip to content

Commit 15e3c5f

Browse files
committed
PDFBOX-5660: avoid default encoding
git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1927130 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4e4e794 commit 15e3c5f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFStreamParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.ByteArrayOutputStream;
2020
import java.io.IOException;
21+
import java.nio.charset.StandardCharsets;
2122
import java.util.ArrayList;
2223
import java.util.List;
2324
import org.apache.logging.log4j.Logger;
@@ -366,7 +367,7 @@ else if (startOpIdx != -1 && endOpIdx == -1 &&
366367
{
367368
// usually, the operator here is Q, sometimes EMC (PDFBOX-2376), S (PDFBOX-3784),
368369
// or a number (PDFBOX-5957)
369-
s = new String(binCharTestArr, startOpIdx, endOpIdx - startOpIdx);
370+
s = new String(binCharTestArr, startOpIdx, endOpIdx - startOpIdx, StandardCharsets.US_ASCII);
370371
if (!"Q".equals(s) && !"EMC".equals(s) && !"S".equals(s) &&
371372
!s.matches("^\\d*\\.?\\d*$"))
372373
{
@@ -381,7 +382,7 @@ else if (startOpIdx != -1 && endOpIdx == -1 &&
381382
if (endOpIdx == -1)
382383
{
383384
endOpIdx = MAX_BIN_CHAR_TEST_LENGTH;
384-
s = new String(binCharTestArr, startOpIdx, endOpIdx - startOpIdx);
385+
s = new String(binCharTestArr, startOpIdx, endOpIdx - startOpIdx, StandardCharsets.US_ASCII);
385386
}
386387
LOG.debug("startOpIdx: {} endOpIdx: {} s = '{}'", startOpIdx, endOpIdx, s);
387388
// look for token of 3 chars max or a number

0 commit comments

Comments
 (0)