1
Vote

Problem with XAMObject.CreateField

description

Hello, I have problem with XAMObject.CreateField for create XSet string field. In our software we use non ASCII encoding string (containst character ěščřžýáíéó and other) for store metadata in Centera. .NET use UTF-16 encoding, but for Centera is required UTF-8 encoding.
 
When I create Xset with NonASCII characters (default .NET encoding) in the metadata, XSet will be saved, but when I try to pick up data from the Centera, I get error code -10214 - problems with parsing XML.
 
In my opinion, should Import.XAM_CreateString defined as follows:
public static extern int XAM_CreateString(XAMHandle inHandle, string inName, [MarshalAs(UnmanagedType.U1)] bool inBinding, byte[] inValue);
 
and method XAMObject.CreateField something like this:
public void CreateField(XString fieldName, XString fieldValue, bool binding)
{
 byte[] utf8Bytes = System.Text.Encoding.UTF8.GetBytes(fieldValue);
 int retval = Imports.XAM_CreateString(xamHandle, fieldName, binding, utf8Bytes);
 Helpers.CheckAndThrow(retval, "XAM_CreateString");
}

comments