Closed felinira closed 1 week ago
Replacing
zvariant::Value::new
withzvariant::SerializeValue
fixes the serialisation issue.
That's very strange. :thinking: The encoding of both should be exactly the same.
I'm afraid I won't have the time to investigate and fix this anytime soon. PRs welcome of course.
The following test code uses glib-rs to construct a VARIANT type gvariant with
glib::Variant::from_variant
and the same variant with zvariant::Value in gvariant mode.This is a byte comparison of the serialisation. Left is glib, right is zvariant:
It looks like zvariant does not encode the key framing offset, while glib does. https://developer.gnome.org/documentation/specifications/gvariant-specification-1.0.html#dictionary-entries.
glib will look for the framing offset, read the dict entry offset instead, and then fail to parse the entry correctly.
This is a comparison of
glib::Variant::print
on these variants, for completion sake:Replacing
zvariant::Value::new
withzvariant::SerializeValue
fixes the serialisation issue. However this is not always possible, especially when having to store variants in unserialized form, or when nesting variants.