`g_param_spec_string` parameters cannot be set to non-utf-8 strings?
I have been taking a look at how to resolve an issue around filename handling in beets. Namely, beets uses gstreamer
and sets the location
parameter of GstFileSrc
to a file path. This parameter is a g_param_spec_string
.
It so happens that sometimes paths in the filesystem will not be UTF-8 encoded, which beets seems to convert into strings with UTF-8 surrogates in them before they are set to a property. These strings then fail to convert in, I believe, an eventual call to pygi_utf8_from_py
. I also tried to set the parameter to a bytestring (b"..."
) or a list of bytes ([1, 2, 3]
), but in either case a debug representation of these values are getting used instead, rather than the underlying bytes.
In practice beets already holds the file system paths as byte strings and it would be great if it was able to set the property up with the bytestring in the first place. However, I can’t seem to be able to find a way to do so. Is there a way to do so, and if not, would it make sense to add a way to do something like this?