On Mon, 2022-07-18 at 13:19 +0300, Povilas Kanapickas wrote:
> By the way, does the current assumption actually break in practice, that
> is, are there compilers for which ASCII text will not encode to a subset
> of ISO-8859-1?
I assume you mean "Are there compilers for which narrow/multibyte string
literals will not encode to a subset of ISO-8859-1?" In that case, I
haven't researched the matter and don't know of a system for which this
is a problem off the top of my head.

Note that if we're unwilling to bump compiler requirements to C11, there
are still a couple options. GCC has the -fexec-charset option to specify
what encoding "ordinary" string literals should be in; we can set this
to ISO-8859-1 when building SANE, but this won't be portable to
compilers without this option.

We could also define a macro that's compatible with older compilers like
this:
#if __STDC_VERSION__ >= 201112L
#define SANE_STRING(X) u8##X
#else
#define SANE_STRING(X) X
#endif

Lastly, iconv() is always an option.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to