emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names i


From: Eric Abrahamsen
Subject: Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8
Date: Fri, 21 Jun 2019 15:55:30 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>                  (decode-coding-string
>> -                 (symbol-name group) 'utf-8)))
>> +                 (symbol-name group) 'raw-text)))
>
> Actually, I was misremembering: raw-text is basically like `binary`, so
> the above `decoding` will only return ASCII and "eight-bit" byte-chars.
> Is that the intention?

To be perfectly honest, I don't know what the intention is, I'm just
trying to preserve original behavior.

Consider the group named nnml:テスト.

------

In Emacs 26, this group name is the symbol
'nnml:\343\203\206\343\202\271\343\203\210, but kept in
gnus-newsrc-alist as the string version of that.

It is written to the newsrc (not newsrc.eld) file with:

(with-current-buffer buf
  (mm-disable-multibyte)
  (insert "nnml:\343\203\206\343\202\271\343\203\210")
  (let ((coding-system-for-write 'raw-text))
    (save-buffer)))
    
And read with:

(set-buffer (nnheader-find-file-noselect newsrc-file))
(setq symbol (read (current-buffer)))
(setq group (symbol-name symbol))

-----

In master, the group name is always the string
"nnml:\343\203\206\343\202\271\343\203\210".

It's written and read the same way.

-----

In scratch/gnus-decoded, the group name is the string "nnml:テスト". It
is written to newsrc with:

(with-current-buffer buf
  (insert "nnml:テスト")
  (let ((coding-system-for-write 'raw-text))
    (save-buffer)))

And read with:

(set-buffer (nnheader-find-file-noselect newsrc-file))
(setq group (read (current-buffer))
      group (decode-coding-string
             (symbol-name group) 'raw-text))

-----

What I'm hoping is that the bytes written to the newsrc file will be
exactly the same over these three versions. This is for interoperability
with other newsreader programs.

The group name itself should go from encoded-string symbol in Emacs 26,
to encoded string in master, to decoded string in scratch/gnus-decoded.

If that's not what's happening, I would like to know!

Eric



reply via email to

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