Skip to content

Commit

Permalink
Updated compiler constants for NET40 (and greater)
Browse files Browse the repository at this point in the history
  • Loading branch information
codebude committed Nov 26, 2021
1 parent 80985a0 commit 75e0db1
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions QRCoder/PayloadGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2494,11 +2494,10 @@ public override string ToString()
var cp = characterSet.ToString().Replace("_", "-");
var bytes = ToBytes();

#if !NET35 && !NET40 && !NETSTANDARD1_3_OR_GREATER
#if !NET35_OR_GREATER && !NETSTANDARD1_3_OR_GREATER
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
#endif
#if NETSTANDARD1_3
// TODO: Fix for NETSTANDARD1.1
#if NETSTANDARD1_3
return Encoding.GetEncoding(cp).GetString(bytes,0,bytes.Length);
#else
return Encoding.GetEncoding(cp).GetString(bytes);
Expand Down Expand Up @@ -3089,11 +3088,7 @@ private static string ConvertStringToEncoding(string message, string encoding)
Encoding utf8 = Encoding.UTF8;
byte[] utfBytes = utf8.GetBytes(message);
byte[] isoBytes = Encoding.Convert(utf8, iso, utfBytes);
#if NET40
return iso.GetString(isoBytes);
#else
return iso.GetString(isoBytes,0, isoBytes.Length);
#endif
return iso.GetString(isoBytes, 0, isoBytes.Length);
}

private static string EscapeInput(string inp, bool simple = false)
Expand Down

0 comments on commit 75e0db1

Please sign in to comment.