emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP


From: Thomas Fitzsimmons
Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP
Date: Tue, 15 Mar 2016 10:39:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Michael Albinus <address@hidden> writes:

> Thomas Fitzsimmons <address@hidden> writes:
>
>> With the soap-client patch reverted, this debbugs.el patch fixes the
>> above test case, producing a correct multibyte string for originator.
>
> Thanks. I've committed it in your name.
>
>> This is just one example, obviously.  The new function should be applied
>> to all values returned by the Debbugs server that may contain multibyte
>> UTF-8 characters.  I'll leave this part to Michael.
>
> Done. The other affected attributes are "subject", "owner" and
> "summary"; I've added them.
>
>> Also, there's still something not quite right about async, for strings
>> that don't contain extended characters:
>>
>> (multibyte-string-p (cdr (assq 'severity (car (async-get (async-start
>>             `(lambda ()
>>                (load ,(locate-library "debbugs"))
>>                (debbugs-get-status 22285))))))))
>> => nil
>>
>> (multibyte-string-p (cdr (assq 'severity (car (debbugs-get-status 22285)))))
>> => t
>>
>> but this looks like a side effect of async.
>
> Hmm, don't know.

I think Andreas explained it with his code snippet.  IIUC, async does a
`read' on the sexp from the child process, and read returns a unibyte
string if there are no non-ASCII characters in the string.  If there are
non-ASCII characters, then read returns a multibyte string:

(let ((pair (read "(\"รก\" \"a\")")))
  (list (multibyte-string-p (car pair))
        (multibyte-string-p (cdr pair))))
=> (t nil)

I don't think this will affect debbugs.el's functionality though, since
it will always decode fields that it knows might contain non-ASCII.

The only difference will be that ASCII-only strings coming back from
debbugs-over-async will be unibyte, whereas ASCII-only strings coming
back from in-process debbugs.el will be multibyte, because:

(multibyte-string-p
 (async-get (async-start
             `(lambda ()
                (decode-coding-string "a" 'utf-8)))))
=> nil

(multibyte-string-p (decode-coding-string "a" 'utf-8))
=> t

As long as no users of the debbugs.el APIs key off multibytedness of the
strings, they'll be fine.  I guess this is a quirk of async, that it
strips the multibytedness of strings that are multibyte-ASCII-only in
the inferior.

> I would like to get rid of async. If `soap-invoke-async' exists
> (soap-client >= 3.0), that function is preferred over
> `async-start'/`async-get'.

The latest soap-client version is also available in GNU ELPA.  Can you
just Package-Requires it, and always rely on the latest version that has
`soap-invoke-async'?

>> I'll wait to revert the soap-client patch on master and emacs-25 until
>> Debbugs has a new release to fix this, to avoid temporarily re-breaking
>> Debbugs.  (However, I'd really like to get this done before Emacs 25.1
>> so that it doesn't go out with an incompatible soap-client API.)
>
> I've increased debbugs' version to 0.9.1, shall be released soon by the
> elpa release script.

Thanks; I should be able to finish the soap-client merge and release
3.1.0 this evening.  Then maybe Debbugs 0.9.2 can Package-Requires
soap-client 3.1.0?

Thomas



reply via email to

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