Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 authored May 5, 2024
1 parent cf29ca3 commit bf04694
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions QRCoder/QRCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -713,9 +713,9 @@ private static int GetCountIndicatorLength(int version, EncodingMode encMode)
private static int GetDataLength(EncodingMode encoding, string plainText, BitArray codedText, bool forceUtf8)
{
// If UTF-8 is forced or the text is detected as UTF-8, return the number of bytes, otherwise return the character count.
return forceUtf8 || IsUtf8(encoding, plainText, forceUtf8) ? (int)((uint)codedText.Length / 8) : plainText.Length;
return forceUtf8 || IsUtf8() ? (int)((uint)codedText.Length / 8) : plainText.Length;

bool IsUtf8(EncodingMode encoding, string plainText, bool forceUtf8)
bool IsUtf8()
{
return (encoding == EncodingMode.Byte && (!IsValidISO(plainText) || forceUtf8));
}
Expand Down

0 comments on commit bf04694

Please sign in to comment.