Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Commit

Permalink
Added html encoding when sending back the output
Browse files Browse the repository at this point in the history
  • Loading branch information
zabirauf committed Sep 18, 2014
1 parent 08c1bcf commit 9defebb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Kernel/Kernel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down
4 changes: 3 additions & 1 deletion Kernel/Shell/ExecuteRequestHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Text;
using System.Threading;
using iCSharp.Kernel.ScriptEngine;
using System.Web;

namespace iCSharp.Kernel.Shell
{
Expand Down Expand Up @@ -88,7 +89,8 @@ private string GetCodeHtmlOutput(ExecutionResult executionResult)
StringBuilder sb = new StringBuilder();
foreach (Tuple<string, ConsoleColor> tuple in executionResult.OutputResultWithColorInformation)
{
sb.Append(string.Format("<font style=\"color:{0}\">{1}</font>", tuple.Item2.ToString(), tuple.Item1));
string encoded = HttpUtility.HtmlEncode(tuple.Item1);
sb.Append(string.Format("<font style=\"color:{0}\">{1}</font>", tuple.Item2.ToString(), encoded));
}

return sb.ToString();
Expand Down

0 comments on commit 9defebb

Please sign in to comment.