Hi
When `snd_card::id` is not specified explicitly it is determined automatically
in `sound/core/init.c:snd_card_register()` as follows:
if (*card->id) {
// ...
} else {
/* create an id from either shortname or longname */
const char *src;
src = *card->shortname ? card->shortname : card->longname;
snd_card_set_id_no_lock(card, src,
retrieve_id_from_card_name(src));
}
However, `snd_card_set_id_no_lock()`, or more specifically the `copy_valid_id_string()`
function that it calls does not seem to copy very well with utf-8.
For example, based on the report at https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4135
where `card->shortname="Redmi 电脑音箱"`, `card->id` will be set to \xE7\xE8\xE9\xE7,
which are the first bytes of the symbols in the suffix "电脑音箱" because only those
bytes of the string satisfy the `isalnum()` check in `copy_valid_id_string()`.
I am not sure what kind of 8-bit character set `isalnum()` is basing these results on, but
it certainly does not mix well with utf-8 in this scenario at least.
Regards,
Barnabás Pőcze
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]