mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Replacing non ISO-8859-1 characters in PDF417 input with '?' (#1514)
* Replacing non ISO-8859-1 characters in input with '?' when neither a character set nor multi-eci encoding is selected. * Changed code to raise an exception for characters not encodeable in ISO-8859-1
This commit is contained in:
parent
8265242784
commit
5f20b8d095
|
@ -171,6 +171,15 @@ final class PDF417HighLevelEncoder {
|
|||
static String encodeHighLevel(String msg, Compaction compaction, Charset encoding, boolean autoECI)
|
||||
throws WriterException {
|
||||
|
||||
if (encoding == null && !autoECI) {
|
||||
for (int i = 0; i < msg.length(); i++) {
|
||||
if (msg.charAt(i) > 255) {
|
||||
throw new WriterException("Non-encodable character detected: " + msg.charAt(i) + " (Unicode: " +
|
||||
(int) msg.charAt(i) +
|
||||
"). Consider specifying EncodeHintType.PDF417_AUTO_ECI and/or EncodeTypeHint.CHARACTER_SET.");
|
||||
}
|
||||
}
|
||||
}
|
||||
//the codewords 0..928 are encoded as Unicode characters
|
||||
StringBuilder sb = new StringBuilder(msg.length());
|
||||
|
||||
|
|
Loading…
Reference in a new issue