示例#1
0
        protected override Encoding DetectStreamEncoding(Stream stream)
        {
            Encoding ret = EncodingUtils.GetEncodingFromConfigXMLName(fmtInfo.Encoding);

            if (ret == null)
            {
                ret = EncodingUtils.DetectEncodingFromBOM(stream, EncodingUtils.GetDefaultEncoding());
            }
            return(ret);
        }
示例#2
0
        protected override Encoding DetectStreamEncoding(Stream stream)
        {
            Encoding ret = EncodingUtils.GetEncodingFromConfigXMLName(formatInfo.Encoding);

            if (ret != null)
            {
                return(ret);
            }
            if (formatInfo.Encoding == "BOM")
            {
                ret = EncodingUtils.DetectEncodingFromBOM(stream, Encoding.UTF8);
            }
            else if (formatInfo.Encoding == "PI")
            {
                ret = EncodingUtils.DetectEncodingFromProcessingInstructions(stream);
                if (ret == null)
                {
                    ret = EncodingUtils.DetectEncodingFromBOM(stream, Encoding.UTF8);
                }
            }
            return(ret);
        }