David Henningsson wrote:
1a) can I count on alsa-lib's strings (everything from card name and mixer identifiers to various descriptions) to be UTF-8 or perhaps even 7-bit?
Alsa-lib itself does not care about the encoding.
The strings are whatever the kernel uses. In practice, this almost always means ASCII, but kernel policy is UTF-8. (At the moment, the only way I know of to get a non-ASCII string is from a USB device.)
Alsa-lib can also return strings from configuration files. These are encoded in whatever the editor happens to use, i.e., in practice, UTF-8.
1b) In what way can buggy drivers violate the answers to 1a?
The USB driver is not buggy. :) But in theory, you could get any random crap.
For testing, you can change a card's "id" attribute in sysfs.
- Can I count on the strings to be zero terminated?
In theory, yes.
snd_ctl_elem_id_set_name
Oops! Using strncpy() here is wrong.
Regards, Clemens