B2026-025_Unicode_removed_from_RO_menu_titles_in_treeview #729

Merged
jjenko merged 5 commits from B2026-025_Unicode_removed_from_RO_menu_titles_in_treeview into Development 2026-03-10 13:23:59 -04:00
3 changed files with 22 additions and 5 deletions
Showing only changes of commit a0be60a1b9 - Show all commits

View File

@@ -2186,6 +2186,20 @@ namespace RODBInterface
}
string xmlstr = GenerateXmlString(ro, false);
StringBuilder xmlstrTmp = new StringBuilder(); // B2026-025 prep the info field data so it will be saved correctly.
char[] chrAry = xmlstr.ToCharArray();
foreach (int chr in chrAry)
{
if (chr > 160)

should this be 160 or 166?

In ctlXMLEdit.cs you have:

				{
					if (chr > 166)
					{
						result1.Append($"\\u{(int)chr}?");
					}
					else
					{
						result1.Append((char)chr);
					}

could be mistaken, but would think this would be consistent?

should this be 160 or 166? In ctlXMLEdit.cs you have: { if (chr > 166) { result1.Append($"\\u{(int)chr}?"); } else { result1.Append((char)chr); } could be mistaken, but would think this would be consistent?
{
xmlstrTmp.Append($"\\u{(int)chr}?");
}
else
{
xmlstrTmp.Append((char)chr);
}
}
string wraccid = null;
if (ro.HasAttribute("AccPageID"))
{
@@ -2209,13 +2223,13 @@ namespace RODBInterface
// strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageID, ModDateTime, Info ) ";
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, AccPageID, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID");
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstr + "');";
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstrTmp + "');";

Ideally, these inserts would be done a different way as concatenating SQL together like this could risk sql injection --- that being said - I believe that would be beyond the scope of this project / CSM item.

Ideally, these inserts would be done a different way as concatenating SQL together like this could risk sql injection --- that being said - I believe that would be beyond the scope of this project / CSM item.
}
else
{
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID");
strInsert = strInsert + "','" + dt + "','" + xmlstr + "');";
strInsert = strInsert + "','" + dt + "','" + xmlstrTmp + "');";
}
}
@@ -2223,7 +2237,7 @@ namespace RODBInterface
{
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageId, ModDateTime, Info ) ";
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.RRO + ",'" + ro.GetAttribute("ParentID");
mschill marked this conversation as resolved Outdated

here - it looks like you are concatenating a stringbuilder with a string --- should

this line have xmlstrTmp.ToString() instead?

here - it looks like you are concatenating a stringbuilder with a string --- should this line have xmlstrTmp.ToString() instead?
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstr + "');";
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstrTmp + "');";
}
try

View File

@@ -96,6 +96,7 @@ using System.IO;
using System.Windows.Forms;
using ROFields;
using VlnStatus;
using System.Text.RegularExpressions;
//using VlnProfiler; //don't forget to add VlnProfiler to the reference list
namespace RODBInterface
@@ -517,7 +518,9 @@ namespace RODBInterface
strtmp.Append(" ");
cnt++;
}
if ((cnt + text.Length) > frmt2) // longer than the field length?
// string sym = symbcode < 256 ? ((char)symbcode).ToString() : string.Format(@"\u{0}", symbcode);
mschill marked this conversation as resolved Outdated

Should commented out code be removed?

Should commented out code be removed?
text = Regex.Replace(text, @"\\u([0-9]{1,4})\?", m => Convert.ToChar(int.Parse(m.Groups[1].Value)).ToString()); //B2026-025 Unicode removed from RO menu titles in treeview.
mschill marked this conversation as resolved
Review

Does there need to be a null check / try parse here?

Does there need to be a null check / try parse here?
if ((cnt + text.Length) > frmt2) // longer than the field length?
strtmp.Append(text.Substring(0,frmt2-cnt));
else
strtmp.Append(text);

View File

@@ -1404,7 +1404,7 @@ namespace Volian.Controls.Library
var pattern = @"\\u([0-9]{1,4})\?"; // RO Editor add symbols C2022 - 003
foreach (Match match in Regex.Matches(linkValue, pattern, RegexOptions.IgnoreCase))
{
linkValue = linkValue.Replace(match.Value, "\\f1 " + match.Value + " \\f0");
linkValue = linkValue.Replace(match.Value, "\\f1 " + match.Value + "\\f0");
}
linkValue = linkValue.Replace(@"{", @"\{");