I previously reported this via the 'contact' link on the project page. But i'll put it here too, just in case.
Hi, you have a slight bug in your routines for unicode serialization.
The following (or many idiomatically similar ways) fixes the issue.
private void WriteString(string value)
{
if (!String.IsNullOrEmpty(value))
{
byte[] buffer = Encoding.UTF8.GetBytes(value);
WriteUInt16((UInt16)buffer.Length);
Write(buffer, 0, buffer.Length);
}
else
{
WriteUInt16(0);
}
}
private void WriteLongString(string value)
{
int length = value.Length;
if (!String.IsNullOrEmpty(value))
{
byte[] buffer = Encoding.UTF8.GetBytes(value);
WriteUInt32((UInt32)buffer.Length);
Write(buffer, 0, buffer.Length);
}
else
WriteUInt32(0);
}
can replace lines 222-241 of Serializer.cs
Previously, you were using the string's character length to determine the number of bytes to write. This is incorrect when the string contained characters which took more than a single byte.
(This is the real solution to the reported bug)
Unicode serialization bugfix