From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?SmFuIERqw6Rydg==?= Newsgroups: gmane.emacs.devel Subject: Re: Bug with UTF-8 string and dbus Date: Wed, 09 Jun 2010 09:28:27 +0200 Message-ID: <4C0F429B.50506@swipnet.se> References: <87typdnr08.fsf@keller.adm.naquadah.org> <87r5kgg1ee.fsf@keller.adm.naquadah.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1276068553 7956 80.91.229.12 (9 Jun 2010 07:29:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Jun 2010 07:29:13 +0000 (UTC) Cc: Eli Zaretskii , Stefan Monnier , emacs-devel@gnu.org To: Julien Danjou Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 09 09:29:11 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OMFio-00047P-Sg for ged-emacs-devel@m.gmane.org; Wed, 09 Jun 2010 09:29:11 +0200 Original-Received: from localhost ([127.0.0.1]:41298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMFio-00086H-2T for ged-emacs-devel@m.gmane.org; Wed, 09 Jun 2010 03:29:10 -0400 Original-Received: from [140.186.70.92] (port=44268 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMFie-0007eb-IP for emacs-devel@gnu.org; Wed, 09 Jun 2010 03:29:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMFiI-0001vw-Pg for emacs-devel@gnu.org; Wed, 09 Jun 2010 03:28:40 -0400 Original-Received: from smtprelay-h22.telenor.se ([195.54.99.197]:54383) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMFiH-0001uj-E0; Wed, 09 Jun 2010 03:28:37 -0400 Original-Received: from ipb3.telenor.se (ipb3.telenor.se [195.54.127.166]) by smtprelay-h22.telenor.se (Postfix) with ESMTP id DBA11EB562; Wed, 9 Jun 2010 09:28:29 +0200 (CEST) X-SENDER-IP: [85.225.45.35] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag4yAJvfDkxV4S0jPGdsb2JhbACDHpslDAEBAQE1LawmkGqBJoMCbgQ X-IronPort-AV: E=Sophos;i="4.53,389,1272837600"; d="scan'208";a="531749987" Original-Received: from c-232de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.35]) by ipb3.telenor.se with ESMTP; 09 Jun 2010 09:28:29 +0200 Original-Received: from [172.20.199.13] (zeplin [172.20.199.13]) by coolsville.localdomain (Postfix) with ESMTPSA id 784E57FA05A; Wed, 9 Jun 2010 09:28:28 +0200 (CEST) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 In-Reply-To: <87r5kgg1ee.fsf@keller.adm.naquadah.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125661 Archived-At: Julien Danjou skrev 2010-06-09 08.34: > On Wed, Jun 09 2010, Eli Zaretskii wrote: > >>>> 492 char *val = SDATA (Fstring_make_unibyte (object)); >>> >>> Fstring_make_unibyte is wrong here. >>> Most likely, if the D-Bus specification mandates UTF-8, the better thing >>> to do would be either to encode using utf-8, or to take advantage of the >>> fact that Emacs already uses utf-8 internally and pass just SDATA (object). > > According to D-Bus spec[1]: > > STRING > > UTF-8 string (must be valid UTF-8). Must be nul terminated and > contain no other nul bytes. > >> Using unencoded SDATA would be wrong with eight-bit characters (aka >> raw bytes). I'd suggest to encode, to be on the safe side. > > Any hint on how to do that ? char *val = SDATA (ENCODE_UTF_8 (object)); should do it. Jan D. > I mean, I don't know the Emacs C API at all, but I can test some > idea/patch if pointed in the appropriate direction. > > [1] http://dbus.freedesktop.org/doc/dbus-specification.html >