GNU bug report logs - #16048
24.3.50; String compare surprise

Previous Next

Package: emacs;

Reported by: michael.albinus <at> gmx.de

Date: Wed, 4 Dec 2013 11:45:03 UTC

Severity: normal

Found in version 24.3.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 16048 <at> debbugs.gnu.org
Subject: bug#16048: 24.3.50; String compare surprise
Date: Thu, 05 Dec 2013 08:51:41 +0100
Stefan Monnier <monnier <at> 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.




This bug report was last modified 11 years and 221 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.