emacs-devel
[Top][All Lists]
Advanced

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

Re: bug#23750: 25.0.95; bug in url-retrieve or json.el


From: Philipp Stephani
Subject: Re: bug#23750: 25.0.95; bug in url-retrieve or json.el
Date: Wed, 28 Dec 2016 18:18:25 +0000



Eli Zaretskii <address@hidden> schrieb am Mi., 30. Nov. 2016 um 19:48 Uhr:
> From: Philipp Stephani <address@hidden>
> Date: Wed, 30 Nov 2016 18:25:09 +0000
> Cc: address@hidden, address@hidden, address@hidden
>
>  > That's right -- why should any code care? Yet url.el does.
>
>  No, it doesn't, not if the string is plain ASCII.
>
> But in that case it isn't, it's morally a byte array.

Yes, because the internal representation of characters in Emacs is a
superset of UTF-8.

That has nothing to do with characters. A byte array is conceptually different from a character string.
 

> What Emacs lacks is good support for byte arrays.

Unibyte strings are byte arrays.  What do you think we lack in that regard?

If unibyte strings should be used for byte arrays, then the URL functions should indeed signal an error whenever url-request-data is a multibyte string, as HTTP requests are conceptually byte arrays, not character strings.
 

> For HTTP, process-send-string shouldn't need to deal
> with encoding or EOL conversion, it should just accept a byte array and send that, unmodified.

I disagree.  Handling unibyte strings is a nuisance, so Emacs allows
most applications be oblivious about them, and just handle
human-readable text.

That is the wrong approach (byte arrays and character strings are fundamentally different types, and mixing them together only causes pain), and it cannot work when implementing network protocols. HTTP requests are *not* human-readable text, they are byte arrays. Attempting to handle Unicode strings can't work because we wouldn't know the number of encoded bytes.

reply via email to

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