From owner-freebsd-arch@FreeBSD.ORG Wed Aug 13 19:37:10 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1E314EFD; Wed, 13 Aug 2014 19:37:10 +0000 (UTC) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2lp0236.outbound.protection.outlook.com [207.46.163.236]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6298924E2; Wed, 13 Aug 2014 19:37:08 +0000 (UTC) Received: from BLUPR05CA0063.namprd05.prod.outlook.com (10.141.20.33) by BY2PR05MB726.namprd05.prod.outlook.com (10.141.223.19) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Wed, 13 Aug 2014 19:37:06 +0000 Received: from BY2FFO11FD058.protection.gbl (2a01:111:f400:7c0c::123) by BLUPR05CA0063.outlook.office365.com (2a01:111:e400:855::33) with Microsoft SMTP Server (TLS) id 15.0.1005.10 via Frontend Transport; Wed, 13 Aug 2014 19:37:04 +0000 Received: from P-EMF01-SAC.jnpr.net (66.129.239.15) by BY2FFO11FD058.mail.protection.outlook.com (10.1.15.178) with Microsoft SMTP Server (TLS) id 15.0.1010.11 via Frontend Transport; Wed, 13 Aug 2014 19:37:04 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF01-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Wed, 13 Aug 2014 12:36:30 -0700 Received: from idle.juniper.net (idleski.juniper.net [172.25.4.26]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id s7DJaJn75280; Wed, 13 Aug 2014 12:36:22 -0700 (PDT) (envelope-from phil@juniper.net) Received: from idle.juniper.net (localhost [127.0.0.1]) by idle.juniper.net (8.14.4/8.14.3) with ESMTP id s7DJaA1r089174; Wed, 13 Aug 2014 15:36:11 -0400 (EDT) (envelope-from phil@idle.juniper.net) Message-ID: <201408131936.s7DJaA1r089174@idle.juniper.net> To: Poul-Henning Kamp Subject: Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML MIME-Version: 1.0 Content-ID: <89170.1407958568.0@idle.juniper.net> Date: Wed, 13 Aug 2014 15:36:10 -0400 From: Phil Shafer X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.15; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(199003)(43234003)(189002)(164054003)(19580395003)(77982001)(4396001)(80022001)(74502001)(84676001)(83072002)(99396002)(71186001)(110136001)(79102001)(76482001)(54356999)(20776003)(84326002)(97736001)(19580405001)(50986999)(83322001)(69596002)(105596002)(86362001)(81156004)(68736004)(46102001)(512954002)(53416004)(87936001)(81542001)(81342001)(92726001)(85306004)(107046002)(21056001)(44976005)(85852003)(103666002)(6806004)(76506005)(74662001)(106466001)(95666004); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR05MB726; H:P-EMF01-SAC.jnpr.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;UriScan:; X-Forefront-PRVS: 0302D4F392 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.15 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.15) smtp.mailfrom=phil@juniper.net; X-OriginatorOrg: juniper.net X-Mailman-Approved-At: Wed, 13 Aug 2014 20:40:01 +0000 Content-Type: text/plain; charset="us-ascii" X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: arch@freebsd.org, John-Mark Gurney , marcel@freebsd.org, "Simon J. Gerraty" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2014 19:37:10 -0000 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.)