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

r. a. schmied uwppp at flash.net
Thu Jul 21 17:01:43 BST 2022


On 07/19/22 18:04, Ralph Little wrote:
> 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
>
>
hey saners

i'm likely that solaris sparc/gcc 4.9 someone and everything i
got is far more than 'pretty ancient'.  heck the gcc4.9 vintage
is only 2014.04.27!  if that is 'pretty ancient' everything else
around here is prehistoric!

gcc 4.9 does provide:
    -std=c++11       Conform to the ISO 2011 C++ standard
    -std=c++14       This switch lacks documentation
    -std=c++1y       Conform to the ISO 2014(?) C++ draft
                     standard (experimental and incomplete support)
and
    -std=c11         Conform to the ISO 2011 C standard (experimental
                     and incomplete support)
    -std=c1x         Deprecated in favor of -std=c11
plus the -std=gnu variants of the above.

whether this compiler is in conformance is unknown to me, but
it seems to work.  but i am unable to get the sane-backend-
1.0.32.86-911be/backend/genesys/* code to yield a functional
scanimage for the canon lide 200.  scanner controls work,
reads image data, but image has loads of vertical bands.
any help with that is welcome.

the important thing to note is this system generated a scanimage
for the sane-backend-1.0.28/backend/genesys_*.cc code, so the basic
c++ infrastructure seems to be ok.


aloha

ras







More information about the sane-devel mailing list