Subject: Re: bug#16048: 24.3.50; String compare surprise

From: Michael Albinus <[email-masked]>
Date: Thu, 05 Dec 2013 08:51:41 +0100

Stefan Monnier <[email-masked]> writes:

>> Beware: byte-to-string returns a unibyte string.  You do NOT want
>> unibyte strings in your application code.
>
> IIUC this is dbus code, so it likely handles marshalled data, which
> often has to manage bytes rather than chars, so a unibyte string might
> be the right thing.

Indeed. My ert test case is

  (should
   (string-equal
    (dbus-unescape-from-identifier
     (dbus-escape-as-identifier "0123abc_xyz\x01\xff"))
    "0123abc_xyz\x01\xff"))

`dbus-unescape-from-identifier' cannot know, whether the original string
was unibyte or multibyte. So it must decide for one, and unibyte seems
to be the better decision.

I will add to the docstring of `dbus-unescape-from-identifier', that it
returns always a unibyte string.

>         Stefan "who doesn't actually know what he's talking about"

Best regards, Michael.