emacs-devel
[Top][All Lists]
Advanced

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

Re: How to get buffer byte length (not number of characters)?


From: Joseph Turner
Subject: Re: How to get buffer byte length (not number of characters)?
Date: Thu, 22 Aug 2024 11:29:48 -0700

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Joseph Turner <joseph@ushin.org>
>> Cc: emacs-devel@gnu.org,  schwab@suse.de,  adam@alphapapa.net
>> Date: Thu, 22 Aug 2024 00:24:45 -0700
>> 
>> > So maybe I misunderstand how these plz.el facilities are used, but up
>> > front this sounds like a mistake.
>> 
>> It could be.  Eli, Adam, what do you think about the default coding
>> systems for encoding the request body in the attached patch?
>
> I think it is better to use detect-coding-region instead, if
> buffer-file-coding-system is undecided.

detect-coding-region is only useful when decoding text, right?

For encoding text, should we encode with buffer-file-coding-system?

>> > By "optionally" you mean that it doesn't always happen, except if the
>> > caller requests that?  If so, the caller of plz.el should decode the
>> > text manually before using it in user-facing features.
>> 
>> By default, `plz' decodes response body according to the 'Content-Type'
>> charset (or utf-8 as fallback).  Passing `:decode nil' stops that.
>
> Sounds correct.

When decoding, should plz fallback to detect-coding-region instead of utf-8?

>> default-file-name-coding-system?
>
> That's for file names, so it is not what you want here.

Thanks!  So when decoding text in hyperdrive.el, we can use (1)
Content-Type charset, or (2) use `detect-coding-region' as a fallback.

IIUC, there's no need to use `set-auto-coding', since
`detect-coding-region' DTRT.

Joseph



reply via email to

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