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: Eli Zaretskii
Subject: Re: emacs-25 b6b47AF: Properly encode/decode base64Binary data in SOAP
Date: Sun, 13 Mar 2016 20:30:02 +0200

> From: Thomas Fitzsimmons <address@hidden>
> Cc: address@hidden,  address@hidden
> Date: Sun, 13 Mar 2016 13:57:32 -0400
> 
>    (defun soap-parse-server-response ()
>      "Error-check and parse the XML contents of the current buffer."
>      (let ((mime-part (mm-dissect-buffer t t)))
>        (unless mime-part
>          (error "Failed to decode response from server"))
>        (unless (equal (car (mm-handle-type mime-part)) "text/xml")
>          (error "Server response is not an XML document"))
>        (with-temp-buffer
>          (mm-insert-part mime-part)
>          (prog1
>              (car (xml-parse-region (point-min) (point-max)))
>            (kill-buffer)
>            (mm-destroy-part mime-part)))))
> 
> mm-insert-part does:
> 
>    (string-to-multibyte (mm-get-part handle no-cache))

Why does it do that?  string-to-multibyte is one of those functions
that should never be used.

> In cases where the caller is expecting an xsd:string, the idea is for
> soap-client to return a native Emacs string, for the caller's
> convenience.

But that's not what string-to-multibyte does.

> I guess soap-client assumes that the mm and xml packages will do the
> right thing to convert XML string values into Emacs's internal
> format.

I'm not sure we are not mis-communicating: conversion into internal
format is what decoding does.  Whereas you just said a few messages
upthread that you thought strings should be returned undecoded,
i.e. as binary streams of bytes.  What am I missing?

> >> Is the attached patch OK for master and emacs-25?
> >
> > Doesn't it bring back the bug which caused Andreas to make the change
> > you want to undo?
> 
> It brings back the behavior of soap-client returning base64-decoded
> xsd:base64Binary values as unibyte strings.

I'm confused: you've just demonstrated that it returns them as
multibyte strings with raw bytes in their multibyte encoding.

> The debate on this thread is about whether that behavior is buggy or
> not.  But yes, I want to revert Andreas's change on both master and
> emacs-25 branches, because I don't consider the old behavior buggy.

That'll bring the bug in the debbugs package back, I think.  Once
again, if you want to return undecoded strings, they should at the
very least be unibyte, not multibyte.  Apologies if I'm too confused
to talk intelligently about this.



reply via email to

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