bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16048: 24.3.50; String compare surprise


From: Michael Albinus
Subject: bug#16048: 24.3.50; String compare surprise
Date: Thu, 05 Dec 2013 08:51:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> 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.





reply via email to

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