[sane-devel] Character encoding used for sane_strstatus() strings

Ralph Little skelband at gmail.com
Wed Jul 20 02:04:24 BST 2022


Hi,

On 2022-07-18 03:19, Povilas Kanapickas wrote:
> Hi John,
>
> On 2022-07-18 05:25, John Scott wrote:
>> The SANE spec says that all strings are encoded in ISO-8859-1 ("Latin-
>> 1"). However, from inspecting the code for sane_strstatus(), it appears
>> that it just returns ordinary string literals, which use whatever
>> encoding the compiler prescribes for narrow string literals and need not
>> be the same.
> Agreed, going by the letter of standards this is indeed a problem.
>
>> So, what character encoding should I be assuming for strings coming from
>> sane_strstatus() as an application writer? One solution to this dilemma
>> is, since sane_strstatus() appears to only use characters from ASCII in
>> the strings, is to use UTF-8 string literals, like this:
>> 	u8"Hello, world"
> This would bump compiler requirements to C11. I don't think this is bad,
> because we already require C++ for at least one popular backend so it's
> unlikely we have many platforms with just ancient C compiler available.
>
> I'm CC'ing Ralph for a second opinion of whether we can start requiring C11.

I personally don't mind going to c11.
Mind you, we did just get an enquiry from someone trying to build on 
Solaris, but they have gcc 4.9 which should support it so it is probably OK.
GCC 4.9 is pretty ancient.

Cheers,
Ralph



More information about the sane-devel mailing list