From 72004768cf965fe5a4fe1b61c59a56a37db67ac2 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 18 Dec 2014 13:56:50 +0100 Subject: [PATCH] U4-5981 Umbraco 7.2 Text encoding when saving partial view template #U4-5981 In Progress Assignee Shandem --- src/Umbraco.Core/IO/PhysicalFileSystem.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Core/IO/PhysicalFileSystem.cs b/src/Umbraco.Core/IO/PhysicalFileSystem.cs index 607e45aec7..7854c2efec 100644 --- a/src/Umbraco.Core/IO/PhysicalFileSystem.cs +++ b/src/Umbraco.Core/IO/PhysicalFileSystem.cs @@ -100,8 +100,19 @@ namespace Umbraco.Core.IO if (stream.CanSeek) stream.Seek(0, 0); - using (var destination = (Stream)File.Create(GetFullPath(fsRelativePath))) - stream.CopyTo(destination); + using (var memoryStream = new MemoryStream()) + { + //Add the BOM + var bom = new byte[] { 0xEF, 0xBB, 0xBF }; + memoryStream.Write(bom, 0, bom.Length); + stream.CopyTo(memoryStream); + + if (memoryStream.CanSeek) + memoryStream.Seek(0, 0); + + using (var destination = (Stream)File.Create(GetFullPath(fsRelativePath))) + memoryStream.CopyTo(destination); + } } public IEnumerable GetFiles(string path)