UI/FormControlPreviewMessage.xaml.cs
changeset 2338 59b3afe16614
parent 2292 669e39629d45
child 2340 ef6f1ae3a234
     1.1 --- a/UI/FormControlPreviewMessage.xaml.cs	Tue Aug 14 15:11:46 2018 +0200
     1.2 +++ b/UI/FormControlPreviewMessage.xaml.cs	Tue Aug 14 16:13:55 2018 +0200
     1.3 @@ -173,7 +173,7 @@
     1.4                  // Ensure UTF-8 encoding
     1.5                  try
     1.6                  {
     1.7 -                    Match m = Regex.Match(htmlString, "<head(.+?)<meta(.+?)content-type(.+?)>", RegexOptions.Singleline | RegexOptions.IgnoreCase);
     1.8 +                    Match m = Regex.Match(htmlString, @"<head(.+?)</head>|<head(.+?)<meta(.+?)content-type(.+?)>", RegexOptions.Singleline | RegexOptions.IgnoreCase);
     1.9                      if (string.IsNullOrEmpty(m?.Value))
    1.10                      {
    1.11                          Regex r = new Regex("<head(.*?)>", RegexOptions.IgnoreCase);
    1.12 @@ -196,7 +196,8 @@
    1.13                          }
    1.14                          else
    1.15                          {
    1.16 -                            utf8 = m.Value.Replace(">", " charset='utf-8'>");
    1.17 +                            Regex reg = new Regex(">");
    1.18 +                            utf8 = reg.Replace(m.Value, " charset='utf-8'>", 1);
    1.19                          }
    1.20                          
    1.21                          Regex r = new Regex(".*", RegexOptions.IgnoreCase);