Re: [rtcweb] PPID, UTF-16 and DOMString (Re: RTCWEB Data Channel: Usage of PPID for protocol multiplexing)

Martin Thomson <martin.thomson@gmail.com> Fri, 07 February 2014 23:45 UTC

Return-Path: <martin.thomson@gmail.com>
X-Original-To: rtcweb@ietfa.amsl.com
Delivered-To: rtcweb@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9AE4F1AD791 for <rtcweb@ietfa.amsl.com>; Fri, 7 Feb 2014 15:45:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, SPF_PASS=-0.001] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EDMkkhOEwECS for <rtcweb@ietfa.amsl.com>; Fri, 7 Feb 2014 15:45:25 -0800 (PST)
Received: from mail-wg0-x230.google.com (mail-wg0-x230.google.com [IPv6:2a00:1450:400c:c00::230]) by ietfa.amsl.com (Postfix) with ESMTP id DB6E41AD72A for <rtcweb@ietf.org>; Fri, 7 Feb 2014 15:45:24 -0800 (PST)
Received: by mail-wg0-f48.google.com with SMTP id x13so2686029wgg.3 for <rtcweb@ietf.org>; Fri, 07 Feb 2014 15:45:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=rQEf02HuQryfXuuPfPVEAgB/gXpvoV1IcCDfDAtHu2M=; b=Gc0Y2ETVSiPZb4fRyzlcJKSDfl43z27tnAqx94iOiyQ4dAVOjhenB+a6HdUrCaTjYc JlzIpYzlNYDKIl5jUl873SVBWBEWQfAdCuFUZbwoT0NFXfw3d/mCNKmxJDso9S4hNAFX 1347FPq+9hRuSXhtDvDyOMAQlyAXHI22D6ARYNs2r1KDZaIm7bJxJFIUmzVhJ9tEe7oL V/0jUGT2mCbfar7ZFsOMV2N11Lmxfd3+pZQXHY6Veh2gzGTuCdF2rFXYAODcrtSujwZ/ MgFxB++Ylza0KBiB93eSkk1W1hNy6ts3V77b35BSx2xOBoVKIVQTmOS2Zstfu0HNJAvY XypQ==
MIME-Version: 1.0
X-Received: by 10.195.13.17 with SMTP id eu17mr12784662wjd.24.1391816724221; Fri, 07 Feb 2014 15:45:24 -0800 (PST)
Received: by 10.227.10.196 with HTTP; Fri, 7 Feb 2014 15:45:24 -0800 (PST)
In-Reply-To: <E1FE4C082A89A246A11D7F32A95A17826DFD40C3@US70UWXCHMBA02.zam.alcatel-lucent.com>
References: <7594FB04B1934943A5C02806D1A2204B1D15E955@ESESSMB209.ericsson.se> <74072016-DA11-41E8-9944-779428163EE4@lurchi.franken.de> <7594FB04B1934943A5C02806D1A2204B1D15ED94@ESESSMB209.ericsson.se> <E1FE4C082A89A246A11D7F32A95A17826DFCF6C8@US70UWXCHMBA02.zam.alcatel-lucent.com> <B304F67A-9EA2-44A0-86DD-9DD0E21CB86F@lurchi.franken.de> <52F4182F.60404@alvestrand.no> <E1FE4C082A89A246A11D7F32A95A17826DFD40C3@US70UWXCHMBA02.zam.alcatel-lucent.com>
Date: Fri, 07 Feb 2014 15:45:24 -0800
Message-ID: <CABkgnnXMYt7teSpxm7chTvQPR8ThKzKQ_bq3Po_FNFv2tdBFGQ@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
To: "Makaraju, Maridi Raju (Raju)" <Raju.Makaraju@alcatel-lucent.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Cc: "rtcweb@ietf.org" <rtcweb@ietf.org>
Subject: Re: [rtcweb] PPID, UTF-16 and DOMString (Re: RTCWEB Data Channel: Usage of PPID for protocol multiplexing)
X-BeenThere: rtcweb@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Real-Time Communication in WEB-browsers working group list <rtcweb.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/rtcweb/>
List-Post: <mailto:rtcweb@ietf.org>
List-Help: <mailto:rtcweb-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/rtcweb>, <mailto:rtcweb-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 07 Feb 2014 23:45:27 -0000

I don't think that we need any complication here.  It's a string.

Strings are UTF-8 on the wire.

Strings are UTF-16 (mostly) in JavaScript.

Anything else would generate pain.

On 7 February 2014 14:01, Makaraju, Maridi Raju (Raju)
<Raju.Makaraju@alcatel-lucent.com> wrote:
>> >> Also, I think "DOMString" PPID is too specific to Javascript, instead it
>> should probably have a generic name like "UTF-16 String". The send API can
>> still use DOMString as this is Javascript API.
>> > Any comments from others?
>>
>> Note: The WebSockets protocol defines the transferred strings as UTF-8.
>> http://tools.ietf.org/html/rfc6455#section-5.6
>>
>> As far as I can tell, we've always intended to follow that example.
>>
>> The fact that Javascript implementations currently choose to represent
>> text strings as UTF-16 at their API is sad, but not an argument for
>> sending that particular text representation over the wire, or reflecting
>> the name in the API.
>
> [Raju] I agree that using UTF-8 is desired and more appropriate! Then, should the PPID be changed from "DOMString" to "UTF-8"? Javascript based apps have to use some library to do the conversion of DOMString/UTF-16 to UTF-8. Alternatively, browsers can do this conversion under the APIs (send and onmessage) before sending and after receiving UTF-8 PPID data.
> Without such conversion webrtc interworking between browsers and native clients will be problematic (basically, will not work).
>
> Another option, which is more flexible, is to define PPIDs for different encodings like "UTF-8", "UTF-16" (or even "base64" for binary to text instead of using "binary" directly); then pass this encoding information to send() and onmessage() calls, which will use these PPIDs. Passing encoding information might be implicit (like Javavscript DOMString) in most languages by the type of the argument to send. This way it is upto the application to deal with the encoding conversions as it see fits.
>
> The latter approach is best suitable for interworking between clients of similar type (web or native); but it is bit painful (to do conversions) for clients of different types.
>
> I am wondering what kind of API calls native WebRTC API stacks (e.g. Google Chrome's http://www.webrtc.org/webrtc-native-code-package) provide for data channel send/onmessage ()? UTF-16 strings? Or UTF-8?
>
> -Raju
>
> _______________________________________________
> rtcweb mailing list
> rtcweb@ietf.org
> https://www.ietf.org/mailman/listinfo/rtcweb