Beispiel #1
0
        protected virtual string ReadContent(byte[] contentBytes, string characterSet, Site site)
        {
            if (string.IsNullOrEmpty(site.EncodingName))
            {
                Encoding htmlCharset = EncodingExtensions.GetEncoding(characterSet, contentBytes);
                return(htmlCharset.GetString(contentBytes, 0, contentBytes.Length));
            }

            return(Encoding.GetEncoding(site.EncodingName).GetString(contentBytes, 0, contentBytes.Length));
        }
        protected virtual object ReadContent(Request request, byte[] contentBytes, string characterSet)
        {
            if (string.IsNullOrEmpty(request.EncodingName))
            {
                Encoding htmlCharset = EncodingExtensions.GetEncoding(characterSet, contentBytes);
                return(htmlCharset.GetString(contentBytes, 0, contentBytes.Length));
            }

            return(Encoding.GetEncoding(request.EncodingName).GetString(contentBytes, 0, contentBytes.Length));
        }