Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
JsonHelpers.cs
Go to the documentation of this file.
2using System.Text;
4
6
7internal static class JsonHelpers
8{
10
12 {
13 return new MediaTypeHeaderValue("application/json")
14 {
15 CharSet = "utf-8"
16 };
17 }
18
19 internal static Encoding GetEncoding(string charset)
20 {
21 Encoding result = null;
22 if (charset != null)
23 {
24 try
25 {
26 result = ((charset.Length <= 2 || charset[0] != '"' || charset[charset.Length - 1] != '"') ? Encoding.GetEncoding(charset) : Encoding.GetEncoding(charset.Substring(1, charset.Length - 2)));
27 }
29 {
31 }
32 }
33 return result;
34 }
35}
static Encoding GetEncoding(string charset)
static MediaTypeHeaderValue GetDefaultMediaType()
static readonly JsonSerializerOptions s_defaultSerializerOptions
Definition JsonHelpers.cs:9
static string CharSetInvalid
Definition SR.cs:14
Definition SR.cs:7
static Encoding GetEncoding(int codepage)
Definition Encoding.cs:593