Received: from eggs.gnu.org ([2001:4830:134:3::10]:36764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpKkh-0005V0-OK for qemu-devel@nongnu.org; Mon, 04 May 2015 14:06:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpKke-0002a6-98 for qemu-devel@nongnu.org; Mon, 04 May 2015 14:05:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36285) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpKke-0002Zt-1l for qemu-devel@nongnu.org; Mon, 04 May 2015 14:05:56 -0400 From: Markus Armbruster References: <1430751937-17523-1-git-send-email-eblake@redhat.com> <1430751937-17523-40-git-send-email-eblake@redhat.com> Date: Mon, 04 May 2015 20:04:48 +0200 In-Reply-To: <1430751937-17523-40-git-send-email-eblake@redhat.com> (Eric Blake's message of "Mon, 4 May 2015 09:05:36 -0600") Message-ID: <87h9rs43sv.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v8 39/40] qapi: Support (subset of) \u escapes in strings List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, berto@igalia.com, qemu-devel@nongnu.org Eric Blake writes: > The handling of \ inside QAPI strings was less than ideal, and > really only worked JSON's \/, \\, \", and our extension of \' > (an obvious extension, when you realize we use '' instead of "" > for strings). For other things, like '\n', it resulted in a > literal 'n' instead of a newline. > > Of course, at the moment, we really have no use for escaped > characters, as QAPI has to map to C identifiers, and we currently > support ASCII only for that. But down the road, we may add > support for default values for string parameters to a command > or struct; if that happens, it would be nice to correctly support > all JSON escape sequences, such as \n or \uXXXX. This gets us > closer, by supporting Unicode escapes in the ASCII range. > > Since JSON does not require \OCTAL or \xXX escapes, and our QMP > implementation does not understand them either, I intentionally > reject it here, but it would be an easy addition if we desired it. > Likewise, intentionally refusing the NUL byte means we don't have > to worry about C strings being shorter than the qapi input. > > Signed-off-by: Eric Blake Reviewed-by: Markus Armbruster