From: Thomas Fitzsimmons <fitzsim@fitzsim.org>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: emacs-devel@gnu.org
Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP
Date: Thu, 10 Mar 2016 22:29:16 -0500 [thread overview]
Message-ID: <m3twkdy9o3.fsf_-_@fitzsim.org> (raw)
In-Reply-To: <mvmmvq6n0ik.fsf@hawking.suse.de> (Andreas Schwab's message of "Thu, 10 Mar 2016 10:30:11 +0100")
Andreas Schwab <schwab@linux-m68k.org> writes:
> Thomas Fitzsimmons <fitzsim@fitzsim.org> writes:
>
>> <originator xsi:type="xsd:base64Binary">Wm9sdMOhbiBLcmFqY3NvdmljcyA8enVsdGhhbmtAZ21haWwuY29tPg==</originator>
>>
>> The test suite expects this to decode as:
>>
>> Zolt\303\241n Krajcsovics [...]
>
> Leaving it undecoded is definitely wrong. Undecoded strings should
> never be used inside Emacs, except for interaction with external
> sources.
Agreed, but I disagree that soap-client itself should be doing the
decoding. SOAP messages are sent to and received from external sources.
In general, an elisp function receiving base64-encoded data from an
external source, via a soap-client call, will want to see it first as a
unibyte string of bytes, in case it's image data or some other
non-string data. If the soap-client caller expects it to be a UTF-8
encoded string, the caller can attempt the string decoding.
>> Do you have an example SOAP message that your patch fixes, and can the
>> surrounding code do the UTF-8 encoding/decoding instead of soap-client
>> itself?
>
> (debbugs-get-status 22285)
OK, thanks. The originator field there is base64 binary. Without your
patch:
(multibyte-string-p (cdr (assoc 'originator (car (debbugs-get-status 22285)))))
=> nil
(length (cdr (assq 'originator (car (debbugs-get-status 22285)))))
=> 51
With your patch:
(multibyte-string-p (cdr (assoc 'originator (car (debbugs-get-status 22285)))))
=> t
(length (cdr (assq 'originator (car (debbugs-get-status 22285)))))
=> 50
Before your patch, what problem did you see? Did some caller of
debbugs-get-status show raw characters somewhere, i.e., did it assume
originator was an already-decoded UTF-8 string? If so, I think that
caller should be fixed (and soap-client should go back to its old
behavior of leaving the string undecoded).
To see what other callers do, I tried (debbugs-org-bugs 22285); it
decodes the originator field itself:
[...]
(originator (when (cdr (assq 'originator status))
(decode-coding-string
(cdr (assq 'originator status)) 'utf-8)))
[...]
which correctly shows the "LATIN SMALL LETTER E WITH ACUTE" in the
*Org Bugs* buffer with the old soap-client behavior.
Thomas
next prev parent reply other threads:[~2016-03-11 3:29 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160106200404.17375.71733@vcs.savannah.gnu.org>
[not found] ` <E1aGuJQ-0004Wv-Lz@vcs.savannah.gnu.org>
2016-03-10 1:03 ` emacs-25 b6b47af: Properly encode/decode base64Binary data in SOAP Thomas Fitzsimmons
2016-03-10 9:30 ` Andreas Schwab
2016-03-11 3:29 ` Thomas Fitzsimmons [this message]
2016-03-11 8:35 ` emacs-25 b6b47AF: " Andreas Schwab
2016-03-11 13:49 ` Alex Harsanyi
2016-03-11 14:09 ` Andreas Schwab
2016-03-11 16:48 ` Stefan Monnier
2016-03-11 16:59 ` Andreas Schwab
2016-03-11 22:27 ` Stefan Monnier
2016-03-13 3:52 ` Thomas Fitzsimmons
2016-03-13 15:15 ` Stefan Monnier
2016-03-13 18:09 ` Thomas Fitzsimmons
2016-03-13 16:02 ` Eli Zaretskii
2016-03-13 17:57 ` Thomas Fitzsimmons
2016-03-13 18:30 ` Eli Zaretskii
2016-03-13 19:54 ` Thomas Fitzsimmons
2016-03-13 20:19 ` Eli Zaretskii
2016-03-13 21:17 ` Thomas Fitzsimmons
2016-03-14 3:30 ` Eli Zaretskii
2016-03-14 8:49 ` Andreas Schwab
2016-03-14 9:15 ` Michael Albinus
2016-03-14 11:56 ` Stefan Monnier
2016-03-14 12:18 ` Alex Harsanyi
2016-03-14 11:58 ` Alex Harsanyi
2016-03-14 12:38 ` Michael Albinus
2016-03-14 13:18 ` Alex Harsanyi
2016-03-14 13:30 ` Michael Albinus
2016-03-14 13:26 ` Stefan Monnier
2016-03-14 14:12 ` Michael Albinus
2016-03-14 14:58 ` Thomas Fitzsimmons
2016-03-14 15:56 ` Michael Albinus
2016-03-14 17:58 ` Eli Zaretskii
2016-03-15 1:56 ` Thomas Fitzsimmons
2016-03-15 7:45 ` Andreas Schwab
2016-03-15 7:57 ` Michael Albinus
2016-03-15 7:49 ` Andreas Schwab
2016-03-15 8:08 ` Michael Albinus
2016-03-15 14:39 ` Thomas Fitzsimmons
2016-03-15 15:04 ` Michael Albinus
2016-03-17 14:23 ` Thomas Fitzsimmons
2016-03-17 15:39 ` Thomas Fitzsimmons
2016-03-17 19:24 ` Michael Albinus
2016-03-17 15:46 ` Stefan Monnier
2016-03-15 17:39 ` Eli Zaretskii
2016-03-14 17:53 ` Eli Zaretskii
2016-03-14 18:47 ` Michael Albinus
2016-03-14 18:57 ` Eli Zaretskii
2016-03-14 17:49 ` Eli Zaretskii
2016-03-14 18:44 ` Michael Albinus
2016-03-14 18:52 ` Eli Zaretskii
2016-03-14 19:05 ` Michael Albinus
2016-03-14 9:23 ` Thomas Fitzsimmons
2016-03-14 9:58 ` Andreas Schwab
2016-03-14 8:02 ` Michael Albinus
2016-03-14 12:39 ` Stefan Monnier
2016-03-14 17:55 ` Eli Zaretskii
2016-03-14 17:48 ` Eli Zaretskii
2016-03-14 18:42 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3twkdy9o3.fsf_-_@fitzsim.org \
--to=fitzsim@fitzsim.org \
--cc=emacs-devel@gnu.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).