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: Eli Zaretskii
Subject: Re: bug#23750: 25.0.95; bug in url-retrieve or json.el
Date: Wed, 28 Dec 2016 20:45:47 +0200

> From: Philipp Stephani <address@hidden>
> Date: Wed, 28 Dec 2016 18:35:58 +0000
> Cc: address@hidden, address@hidden, address@hidden, 
>       address@hidden
> 
>  How do you see that process-send-string special-cases unibyte strings?
> 
> The send_process function has two branches, one for unibyte, one for 
> multibyte.

That's not special-casing.  That's polymorphism, if you like: Emacs
silently does TRT for both.

>  We are miscommunicating. string-to-unibyte can only meaningfully be
>  called on a pure-ASCII string, and for pure-ASCII strings 'length'
>  will count bytes. So I see no need for 'byte-array-length' if its
>  implementation is as you indicated.
> 
> That depends on how you want to represent byte arrays/octet streams in Emacs. 
> If you want to represent
> them using unibyte strings, then you indeed only need `length'. But some 
> earlier messages sounded like you
> wanted to represent byte arrays either using unibyte strings or byte-only 
> multibyte strings. In that case
> `string-to-unibyte' is necessary.

No, it's not.  Multibyte strings that include raw bytes are converted
to single bytes when you encode them.

>  Once you encoded the string, why do you need anything except calling
>  process-send-string?
> 
> The byte size should be added as a Content-length HTTP header. If 
> url-request-data is a unibyte string, that's
> not a problem (except for the newline conversion behavior in send_string), 
> you can just use `length'. But if it's
> a multibyte string, you need to encode first to find the byte length. 

I thought we've just agreed that multibyte strings there should not be
allowed.



reply via email to

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