Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2014 15:36:10 -0400
From:      Phil Shafer <phil@juniper.net>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@freebsd.org, John-Mark Gurney <jmg@funkthat.com>, marcel@freebsd.org, "Simon J. Gerraty" <sjg@juniper.net>
Subject:   Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML
Message-ID:  <201408131936.s7DJaA1r089174@idle.juniper.net>

next in thread | raw e-mail | index | archive | help
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?  Is FreeBSD using Notes for other information currently?

Thanks,
 Phil

P.s.: Attached is a screenshot of a quick demo using netstat output
rendered in HTML with the jquery qtip popup that shows the XPath,
along with some firebug output to show the contents.  (The "data-qtip"
attribute is added dynamically by the qtip library.)




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408131936.s7DJaA1r089174>