For Linux systems, C11 is a bit of the default as the Linux kernel now requires C11. So that would get all the major Linux distros.
On Mon, Jul 18, 2022 at 10:48 AM John Scott <[email protected]> wrote: > > 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. -- Kelly "STrRedWolf" Price http://redwolf.ws
