mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add ECI segment whenever encoding is explicitly given, even when it's the default encoding
This commit is contained in:
parent
87f00d41a7
commit
2434efd625
|
@ -78,7 +78,8 @@ public final class Encoder {
|
|||
|
||||
// Determine what character encoding has been specified by the caller, if any
|
||||
String encoding = DEFAULT_BYTE_MODE_ENCODING;
|
||||
if (hints != null && hints.containsKey(EncodeHintType.CHARACTER_SET)) {
|
||||
boolean hasEncodingHint = hints != null && hints.containsKey(EncodeHintType.CHARACTER_SET);
|
||||
if (hasEncodingHint) {
|
||||
encoding = hints.get(EncodeHintType.CHARACTER_SET).toString();
|
||||
}
|
||||
|
||||
|
@ -91,7 +92,7 @@ public final class Encoder {
|
|||
BitArray headerBits = new BitArray();
|
||||
|
||||
// Append ECI segment if applicable
|
||||
if (mode == Mode.BYTE && !DEFAULT_BYTE_MODE_ENCODING.equals(encoding)) {
|
||||
if (mode == Mode.BYTE && (hasEncodingHint || !DEFAULT_BYTE_MODE_ENCODING.equals(encoding))) {
|
||||
CharacterSetECI eci = CharacterSetECI.getCharacterSetECIByName(encoding);
|
||||
if (eci != null) {
|
||||
appendECI(eci, headerBits);
|
||||
|
|
Loading…
Reference in a new issue