Skip to content

Commit 80448a1

Browse files
authored
Fix condition for ISO-8859-1 encoding selection in GetTargetEncoding method (#681)
1 parent 6cd987c commit 80448a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

QRCoder/QRCodeGenerator/ByteDataSegment.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private static Encoding GetTargetEncoding(string plainText, EciMode eciMode, boo
122122
Encoding targetEncoding;
123123

124124
// Check if the text is valid ISO-8859-1 and UTF-8 is not forced, then encode using ISO-8859-1.
125-
if (IsValidISO(plainText) && !forceUtf8)
125+
if (eciMode == EciMode.Default && !forceUtf8 && IsValidISO(plainText))
126126
{
127127
targetEncoding = _iso8859_1;
128128
includeUtf8BOM = false;

0 commit comments

Comments
 (0)