internal static void GenerateReportBody(MessageItem message, Stream outputStream, out CultureInfo cultureInfo, out Charset charset) { if (ObjectClass.IsDsn(message.ClassName)) { ReportMessage.GenerateDsnBody(message, outputStream, DsnHumanReadableWriter.DefaultDsnHumanReadableWriter, null, out cultureInfo, out charset); return; } ReportMessage.GenerateOldFashionedReportBody(message, outputStream, out cultureInfo, out charset); }
private static void GenerateOldFashionedReportBody(MessageItem message, Stream outputStream, out CultureInfo cultureInfo, out Charset charset) { Encoding unicode = Encoding.Unicode; string text = ReportMessage.GenerateOldFashionedReportBody(message, out cultureInfo).ToString(cultureInfo); OutboundCodePageDetector outboundCodePageDetector = new OutboundCodePageDetector(); outboundCodePageDetector.AddText(text); charset = Charset.GetCharset(outboundCodePageDetector.GetCodePage(Culture.GetCulture(cultureInfo.Name), false)); using (MemoryStream memoryStream = new MemoryStream(unicode.GetBytes(text))) { new TextToHtml { InputEncoding = unicode, OutputEncoding = charset.GetEncoding() }.Convert(memoryStream, outputStream); } }