/// <summary> /// 根据提交类型获取编码字符集 /// </summary> /// <param name="contentType">提交类型</param> /// <returns>编码字符集</returns> private static Encoding getEncoding(string contentType) { foreach (SubString value in contentType.split(';')) { SubString key = value.Trim(); if (key.StartsWith(CharsetName)) { try { key.MoveStart(CharsetName.Length); return(Encoding.GetEncoding(key)); } catch (Exception error) { AutoCSer.Log.Pub.Log.Add(Log.LogType.Debug | Log.LogType.Info, error, key.ToString(), true); } } } return(null); }
/// <summary> /// 根据提交类型获取编码字符集 /// </summary> /// <param name="contentType">提交类型</param> /// <returns>编码字符集</returns> private static Encoding getEncoding(string contentType) { foreach (SubString value in contentType.split(';')) { SubString key = value.Trim(); if (key.StartsWith(CharsetName)) { try { key.MoveStart(CharsetName.Length); return(Encoding.GetEncoding(key)); } catch (Exception error) { AutoCSer.LogHelper.Exception(error, key.ToString(), LogLevel.Exception | LogLevel.AutoCSer); } } } return(null); }