I'm trying to store a gzipped binary serialized object into Active Directory's "Extension Attribute", more info here. This field is a Unicode string according to it's oM syntax of 64.
I'm saving the binary object into AD's Unicode format like this:
byte[] bytes = ... // This is my blob
System.Text.Encoding.Unicode.GetString(bytes);
I then save it to extension attribute #14. The issue is that when I read the value I don't get my entire string back.
Here is a screenshot of what is actually saved to the server:
Here is a screenshot of what comes back:
I am guessing that the \0 is causing the problem, and that probably means null. How should I handle this? Are there other chars I should also be escaping besides null?