Open Minoru opened 1 year ago
Wow, so gettext-rs is broken for musl's built-in implementation of gettext, because:
bind_textdomain_codeset()
only supports UTF-8 in musl (returns EINVAL
for all other codesets);bind_textdomain_codeset()
always returns NULL
, which we treat as an error.The first one is our problem; we should adjust gettext-rs/tests/integration.rs to handle this.
The second one, I'm not sure. My local manpage for bind_textdomain_codeset()
says:
If no codeset has been set for domain domainname, it returns NULL.
And also:
If codeset is NULL, the function returns the previously set codeset for domain domainname. The default is NULL, denoting the locale's character encoding.
I think musl stretches the definitions here, always returning NULL
to indicate that it uses locale's charset, which in musl is always UTF-8.
OTOH, regardless of how valid musl's choice is, that's the reality and we should support it. In that case, it's our fault that we assume that NULL
return value means failure.
I'll let this sit for a few days while I think how to proceed.
This works around a segfault in tests: https://github.com/Koka/gettext-rs/issues/99