DECLINED: the issue is in the client's code.
To reproduce:
- add a dock with some windows
- save the layout with this code:
var stringWriter = new StringWriter();
radDock1.SaveToXml(stringWriter);
savedLayoutString = stringWriter.ToString(); //with this line you can save the same stream to a file and observe that it is saved with UTF-16
- load the layout with the following code:
using (var stream = new MemoryStream())
{
var streamWriter = new StreamWriter(stream);
streamWriter.Write(savedLayoutString);
streamWriter.Flush();
stream.Position = 0;
radDock1.LoadFromXml(stream);
}
Workaround - when reading the xml, replace utf-16 with utf-8
streamWriter.Write(File.ReadAllText("qqq.xml").Replace("utf-16", "utf-8"));
DECLINED: the issue is in the client's code. All strings in C# are UTF-16 encoded (this is their inter internal memory representation) and therefore when saving the XML to a C# string, it gets encoded in UTF-16. However, when loading the layout, the code above is using StreamWriter to write the string to a memory stream and by default the StreamWriter is not writing in UTF-16 which will result in improperly encoded data in the memory stream. To avoid that, you need to specify the encoding when initializing the StreamWriter:
using (var stream = new MemoryStream())
{
var streamWriter = new StreamWriter(stream, Encoding.Unicode);
streamWriter.Write(layout);
streamWriter.Flush();
stream.Position = 0;
radDock1.LoadFromXml(stream);
}