Need help with fixed length strings

i’m having trouble when putting values on a string column of a compound dataset i’ve created, i want it to be a fixed length column that has the size equal to the biggest length between all the values i’m writing (this number i can get easily), the problem happens when i write it because i get strange characters on the value column on HDFView, when i make a string column with variable length it works fine using Marshal.StringToHGlobalAnsi() storing an IntPointer to my struct and store it, but when i change it to a fixed length it seems to break everything

Here is the struct i’m using:

struct OpcString
public UInt64 dt;
public Int64 qlt;
public bool isNull;
public IntPtr vl;

and this is the part of the code i create the datatype of the dataset

 H5DataTypeId stringTypeId = H5T.create(H5T.CreateClass.STRING, maxLen);

  var size = H5T.getSize(stringTypeId);
  OpcString opcHelper = new OpcString();
  H5DataTypeId dataTypeId = H5T.create(H5T.CreateClass.COMPOUND, (Marshal.SizeOf(opcHelper)));
  H5T.insert(dataTypeId, "Timestamp", 0, new H5DataTypeId(H5T.H5Type.NATIVE_ULLONG));
  H5T.insert(dataTypeId, "Quality", 8, new H5DataTypeId(H5T.H5Type.NATIVE_LONG));
  H5T.insert(dataTypeId, "IsNull", 16, new H5DataTypeId(H5T.H5Type.NATIVE_HBOOL));
  H5T.insert(dataTypeId, "Value", 20, stringTypeId);

Here is the conversion that i use to recieve a string and storing as an intptr on the hdf5 so i get rid of the encoding issues

static IntPtr ConvertTo(string s)
  var x = Marshal.StringToHGlobalAnsi(s);
  return x;

I really don’t knonw where the problem is because i can’t seem to understand how strings work