From cd0f38764d34b54e027688ee944498278c3a8031 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 11 Aug 2023 16:42:12 +0100 Subject: [PATCH] fix: send charset=utf-8 for content-type header --- OliverBooth/Areas/Blog/Pages/RawArticle.cshtml.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OliverBooth/Areas/Blog/Pages/RawArticle.cshtml.cs b/OliverBooth/Areas/Blog/Pages/RawArticle.cshtml.cs index 2e7ca93..9fe6bc7 100644 --- a/OliverBooth/Areas/Blog/Pages/RawArticle.cshtml.cs +++ b/OliverBooth/Areas/Blog/Pages/RawArticle.cshtml.cs @@ -29,18 +29,20 @@ public class RawArticle : PageModel { return NotFound(); } - + + Response.Headers.Add("Content-Type", "text/plain; charset=utf-8"); + using Utf8ValueStringBuilder builder = ZString.CreateUtf8StringBuilder(); builder.AppendLine("# " + post.Title); if (_blogService.TryGetAuthor(post, out Author? author)) builder.AppendLine($"Author: {author.Name}"); - + builder.AppendLine($"Published: {post.Published:R}"); if (post.Updated.HasValue) builder.AppendLine($"Updated: {post.Updated:R}"); - + builder.AppendLine(); builder.AppendLine(post.Body); - return Content(builder.ToString(), "text/plain"); + return Content(builder.ToString()); } }