XML Output: libxo - provide single API to output TXT, XML, JSON and HTML
Konstantin Belousov
kostikbel at gmail.com
Thu Aug 14 05:26:59 UTC 2014
On Wed, Aug 13, 2014 at 03:36:10PM -0400, Phil Shafer wrote:
> Phil Shafer writes:
> >FWIW, the UTF-8 strategy for libox is this:
> >- all format strings are UTF-8
> >- argument strings (%s) are UTF-8
> >- "%ls" handles wide characters
> >- "%hs" will handle locale-based strings
> >- XML, JSON, and HTML will be UTF-8 output
> >- text will be locale-based
>
> Sorry for the delay, but this code is now done. Formatting widths
> are done using wcwidth() so things like "%15.15s" work correctly
> regardless of locale settings. As a background task, I'm converting
> some basic commands to use libxo. It's slow work, but needs done....
>
> I've a related topic: when an app goes to run a child command, how
> can it determine whether that binary supports libxo-based encoding
> requests? This should be known before the binary is run, since
> there's no means of auto-detecting the supported output after the
> fact.
>
> For example, say I want to make a JSON-based API for my server. I
> can setenv("LIBXO_OPTIONS", "json") to get JSON output, but I won't
> know if the binary supports this or if the output needs to be wrapped
> and escaped.
>
> I know ELF "Note" elements can be used to carry vendor-specific
> data, but have no experience with them. Would it be reasonable to
> use them as a means of communicating this information to other bits
> of software?
No.
> Is FreeBSD using Notes for other information currently?
Yes, the notes are used to communicate the information required by
the dynamic linker to correctly activate the image. The mechanism has
nothing to do with application-specific features, and overloading it for
that purpose is severe and pointless layering violation. Things should
not be done just because they could be done.
Using the static tagging for the dynamic application properties is wrong
anyway. E.g., would you consider the mere fact that the binary is linked
against your library, as the indication that your feature is supported ?
If not, how does it differ from the presence of some additional note ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20140814/17f4a91b/attachment.sig>
More information about the freebsd-arch
mailing list