Subject: Re: bug#70301: 30.0.50; secrets-create-item mangles cyrillic passwords

From: Michael Albinus <[email-masked]>
Date: Wed, 10 Apr 2024 18:10:00 +0200

Eli Zaretskii <[email-masked]> writes:

Hi Eli,

>> Thanks for the patch. However, I believe we shouldn't fix it in
>> secrets.el, but in dbus.el.
>
> Then we ought to update the doc string of dbus-string-to-byte-array,
> which currently says the argument should be a UTF-8 encoded string.

Yep.

>> > Michael, I think we have a similar problem in
>> > dbus-byte-array-to-string: when MULTIBYTE is non-nil, the function
>> > should call decode-coding-string on the unibyte string it produces
>> > instead of converting each byte to multibyte.  Because the bytes in
>> > the argument BYTE-ARRAY are not characters, they are raw bytes of the
>> > UTF-8 sequence, so calling 'string' on them is not TRT.
>>
>> Yes. The following patch works for me. WDYT?
>
> If you are okay with changing the behavior of
> dbus-byte-array-to-string in backward-incompatible ways, I don't mind.
> But maybe this should be called out in NEWS.

I'm aware of this incompatibility. Well, I've played several hours today
with this. Since we have no information from D-Bus about the underlying
byte array, we must assume a given context. A sequence of raw 8-bit
bytes, unibyte, representing an UTF-8 encoded string seems to be aapropriate.

If people want another conversion for a D-Bus byte array, it is still
possible. But they shouldn't use dbus-byte-array-to-string and
dbus-string-to-byte-array then.

I'll puzzle everything together by tomorrow.

Best regards, <<michael.