diff --git a/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs b/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs index 3e664bd13a..1704fe57d6 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/BaseView.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.IO; using System.Linq; +using System.Text; using System.Threading.Tasks; using Microsoft.AspNet.Http; using Microsoft.Framework.Internal; @@ -52,7 +53,7 @@ namespace Microsoft.AspNet.Diagnostics.Views Context = context; Request = Context.Request; Response = Context.Response; - Output = new StreamWriter(Response.Body); + Output = new StreamWriter(Response.Body, Encoding.UTF8, 4096, leaveOpen: true); HtmlEncoder = context.ApplicationServices.GetHtmlEncoder(); await ExecuteAsync(); Output.Dispose(); @@ -199,7 +200,7 @@ namespace Microsoft.AspNet.Diagnostics.Views /// The to write. /// /// is invoked for types. - /// For all other types, the encoded result of is written to the + /// For all other types, the encoded result of is written to the /// . /// protected void WriteTo(TextWriter writer, object value) diff --git a/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cs b/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cs index f59e04c010..5d10cc856b 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cs @@ -51,7 +51,7 @@ using Views #line 10 "CompilationErrorPage.cshtml" Response.StatusCode = 500; - Response.ContentType = "text/html"; + Response.ContentType = "text/html; charset=utf-8"; Response.ContentLength = null; // Clear any prior Content-Length #line default diff --git a/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cshtml b/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cshtml index 476dc2ff11..143ab573cf 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cshtml +++ b/src/Microsoft.AspNet.Diagnostics/Views/CompilationErrorPage.cshtml @@ -9,7 +9,7 @@ } @{ Response.StatusCode = 500; - Response.ContentType = "text/html"; + Response.ContentType = "text/html; charset=utf-8"; Response.ContentLength = null; // Clear any prior Content-Length } diff --git a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs index 01efddc1e2..cf8002af99 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs +++ b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cs @@ -57,7 +57,7 @@ using Views Response.StatusCode = 500; // TODO: Response.ReasonPhrase = "Internal Server Error"; - Response.ContentType = "text/html"; + Response.ContentType = "text/html; charset=utf-8"; Response.ContentLength = null; // Clear any prior Content-Length string location = string.Empty; diff --git a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml index e511c11136..03062a23e0 100644 --- a/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml +++ b/src/Microsoft.AspNet.Diagnostics/Views/ErrorPage.cshtml @@ -15,7 +15,7 @@ @{ Response.StatusCode = 500; // TODO: Response.ReasonPhrase = "Internal Server Error"; - Response.ContentType = "text/html"; + Response.ContentType = "text/html; charset=utf-8"; Response.ContentLength = null; // Clear any prior Content-Length string location = string.Empty; }