modernuo/Projects/Server.Tests/Helpers/EncodingHelpers.cs
Kamron Batman 211c2ba8ee
fix(core): Streamlines text encoding (#407)
- [X] Streamlines text encoding
2021-01-13 18:56:32 -08:00

17 lines
438 B
C#

using System.Text;
using Server.Text;
namespace Server.Tests
{
public static class EncodingHelpers
{
public static Encoding GetEncoding(string bodyname) =>
bodyname switch
{
"utf-8" => TextEncoding.UTF8,
"utf-16" => TextEncoding.UnicodeLE,
"utf-16BE" => TextEncoding.Unicode,
_ => Encoding.ASCII
};
}
}