[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug with UTF-8 string and dbus

From: Jan Djärv
Subject: Re: Bug with UTF-8 string and dbus
Date: Wed, 09 Jun 2010 09:28:27 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; sv-SE; rv: Gecko/20100512 Thunderbird/3.0.5

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]:


           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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]