Index: mediaportal/Databases/DatabaseUtility.cs =================================================================== --- mediaportal/Databases/DatabaseUtility.cs (revision 27966) +++ mediaportal/Databases/DatabaseUtility.cs (working copy) @@ -19,6 +19,7 @@ #endregion using System; +using System.Text.RegularExpressions; using MediaPortal.GUI.Library; using SQLite.NET; @@ -363,7 +364,7 @@ return string.Empty; } - + /// /// This will remove all chars which are not allowed for the DB and quote / escape when needed /// @@ -382,6 +383,7 @@ /// The value to be stored public static void RemoveInvalidChars(ref string strTxt) { + CleanString(ref strTxt); strTxt = FilterText(strTxt); } @@ -421,5 +423,34 @@ strPath = strFileNameAndPath.Substring(0, i).Trim(); strFileName = strFileNameAndPath.Substring(i, strFileNameAndPath.Length - i).Trim(); } + + /// + /// This will clean/replace some special chars (XML special chars, non breakin space..) + /// + /// The value to be stored + public static void CleanString(ref string strTxt) + { + if (string.IsNullOrEmpty(strTxt)) + { + return; + } + + strTxt = CleanTxt(strTxt); + } + + private static string CleanTxt (string strTxt) + { + // Non breaking space to space + strTxt = Regex.Replace(strTxt, @"\u00A0", " "); + + // XML special codes into normal chars + strTxt = strTxt.Replace("&", "&"); + strTxt = strTxt.Replace("<", "<"); + strTxt = strTxt.Replace(">", ">"); + strTxt = strTxt.Replace(""", "\""); + strTxt = strTxt.Replace("'", "'"); + + return strTxt; + } } } \ No newline at end of file