public static string stringFromNativeUtf8(IntPtr nativeUtf8)
{
// There is no one line marshal IntPtr->string for UTF8
int len = stringLengthUtf8(nativeUtf8);
if (len == 0) return string.Empty;
byte[] buffer = new byte[len];
Marshal.Copy(nativeUtf8, buffer, 0, buffer.Length);
return Encoding.UTF8.GetString(buffer, 0, len);
}
}