From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: String handling in xwidget primitives Date: Sat, 30 Jan 2016 09:57:37 +0200 Message-ID: <83zivnwlce.fsf@gnu.org> References: <838u38xklk.fsf@gnu.org> <56ABEE50.7070804@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1454140716 5740 80.91.229.3 (30 Jan 2016 07:58:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jan 2016 07:58:36 +0000 (UTC) Cc: joakim@verona.se, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 30 08:58:29 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aPQQN-0006iM-Pf for ged-emacs-devel@m.gmane.org; Sat, 30 Jan 2016 08:58:27 +0100 Original-Received: from localhost ([::1]:37846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPQQN-0002TI-2X for ged-emacs-devel@m.gmane.org; Sat, 30 Jan 2016 02:58:27 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54116) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPQQA-0002Sz-BD for emacs-devel@gnu.org; Sat, 30 Jan 2016 02:58:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPQQ6-0002b0-B0 for emacs-devel@gnu.org; Sat, 30 Jan 2016 02:58:14 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34986) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPQQ6-0002av-7R; Sat, 30 Jan 2016 02:58:10 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1377 helo=HOME-C4E4A596F7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aPQQ3-0002UI-Ez; Sat, 30 Jan 2016 02:58:07 -0500 In-reply-to: <56ABEE50.7070804@cs.ucla.edu> (message from Paul Eggert on Fri, 29 Jan 2016 14:57:20 -0800) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199029 Archived-At: > Cc: emacs-devel@gnu.org > From: Paul Eggert > Date: Fri, 29 Jan 2016 14:57:20 -0800 > > On 01/29/2016 11:16 AM, Eli Zaretskii wrote: > > The primitives xwidget-webkit-goto-uri and > > xwidget-webkit-execute-script accept Lisp strings as arguments and > > pass their data unaltered to the underlying GTK functions. I think we > > need to encode these strings first, but I cannot figure out which > > encoding should be used. Is it UTF-8 or something locale-dependent? > > As I understand it the default is UTF-8, but you can override this by > using a custom encoding. I'd guess we should just use the default. Sure, if UTF-8 is accepted by default, it's the best and easiest alternative. > Dumb question: shouldn't URIs be encoded in punycode? Good question. I don't know. The URI gets passed to the webkit_web_view_load_uri API from WebKitGTK, whose documentation says nothing about this (or the encoding in general). Maybe someone could look in the sources and figure out what's TRT, or find the information somewhere. My personal impression from googling about this is that at least JS seems to not expect URIs in punycode. But I may be mistaken. > > Also, random documents on the Internet claim JS scripts should have a > > BOM if they are in UTF-8, is that correct? > > > > I'm skeptical. No doubt there are issues in this area, but I can also > find random documents saying that JS scripts *with* BOMs make programs > croak, e.g.: > > http://compgroups.net/comp.lang.php/javascript-php-byte-order-mark-problem/1384837 > > Plus, I see some evidence that at least one JavaScript linter will warn > you about BOMs: > > https://github.com/jshint/jshint/pull/2285 Thanks, I guess that answers the question.