XML Output: libxo - provide single API to output TXT, XML, JSON and HTML

Poul-Henning Kamp phk at phk.freebsd.dk
Thu Jul 31 20:07:41 UTC 2014


--------
In message <20140731175547.GO43962 at funkthat.com>, John-Mark Gurney writes:
>Phil Shafer wrote this message on Wed, Jul 30, 2014 at 19:24 -0400:
>> John-Mark Gurney writes:
>> >My vote would be to use and *enforce* UTF-8 by the API.   That means if
>> >someone passes a string in, it must be properly formed UTF-8...
>> 
>> I can certainly see making this an option, detecting the high-bit
>> and inspecting the following 1-5 bytes to ensure the corresponding
>> high two bits are set appropriately.  But what action would you
>> expect the library to take when invalid strings are passed in?
>
>Return an error?  printf can return an error, yet most people don't
>check it.. so no real difference in API/bugs...

This is why we ended up with SIGPIPE in the first place.

Can I point discreetely at sbuf(3)'s accumulative error handling
and suggest that libxo does something similar ?  That way applications
only need to check for errors once, rather than after every single
call to every single function in the libxo library.

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.


More information about the freebsd-arch mailing list