Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CharacterSet

string? System.Net.HttpWebResponse.CharacterSet
get

Definition at line 184 of file HttpWebResponse.cs.

185 {
186 get
187 {
189 string text = Headers["Content-Type"];
190 if (_characterSet == null && !string.IsNullOrWhiteSpace(text))
191 {
192 _characterSet = string.Empty;
193 string text2 = text.ToLowerInvariant();
194 if (text2.Trim().StartsWith("text/", StringComparison.Ordinal))
195 {
196 _characterSet = "ISO-8859-1";
197 }
198 int i = text2.IndexOf(';');
199 if (i > 0)
200 {
201 while ((i = text2.IndexOf("charset", i, StringComparison.Ordinal)) >= 0)
202 {
203 i += 7;
204 if (text2[i - 8] != ';' && text2[i - 8] != ' ')
205 {
206 continue;
207 }
208 for (; i < text2.Length && text2[i] == ' '; i++)
209 {
210 }
211 if (i < text2.Length - 1 && text2[i] == '=')
212 {
213 i++;
214 int num = text2.IndexOf(';', i);
215 if (num > i)
216 {
217 _characterSet = text.AsSpan(i, num - i).Trim().ToString();
218 }
219 else
220 {
221 _characterSet = text.AsSpan(i).Trim().ToString();
222 }
223 break;
224 }
225 }
226 }
227 }
228 return _characterSet;
229 }
230 }