* Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 [not found] ` <20190621205533.D5EB520A01@vcs0.savannah.gnu.org> @ 2019-06-21 22:17 ` Stefan Monnier 2019-06-21 22:55 ` Eric Abrahamsen 0 siblings, 1 reply; 4+ messages in thread From: Stefan Monnier @ 2019-06-21 22:17 UTC (permalink / raw) To: emacs-devel; +Cc: Eric Abrahamsen > (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? Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 2019-06-21 22:17 ` [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 Stefan Monnier @ 2019-06-21 22:55 ` Eric Abrahamsen 2019-06-22 8:20 ` Andreas Schwab 0 siblings, 1 reply; 4+ messages in thread From: Eric Abrahamsen @ 2019-06-21 22:55 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel Stefan Monnier <monnier@iro.umontreal.ca> 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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 2019-06-21 22:55 ` Eric Abrahamsen @ 2019-06-22 8:20 ` Andreas Schwab 2019-06-22 15:45 ` Eric Abrahamsen 0 siblings, 1 reply; 4+ messages in thread From: Andreas Schwab @ 2019-06-22 8:20 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: Stefan Monnier, emacs-devel On Jun 21 2019, Eric Abrahamsen <eric@ericabrahamsen.net> wrote: > 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)) The coding rules for symbols and strings are quite different. If you want read a symbol, you need to write a symbol. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 2019-06-22 8:20 ` Andreas Schwab @ 2019-06-22 15:45 ` Eric Abrahamsen 0 siblings, 0 replies; 4+ messages in thread From: Eric Abrahamsen @ 2019-06-22 15:45 UTC (permalink / raw) To: Andreas Schwab; +Cc: Stefan Monnier, emacs-devel Andreas Schwab <schwab@linux-m68k.org> writes: > On Jun 21 2019, Eric Abrahamsen <eric@ericabrahamsen.net> wrote: > >> 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)) > > The coding rules for symbols and strings are quite different. If you > want read a symbol, you need to write a symbol. Actually what I want is to read/write strings. The calls to `read' made sense when group names were always symbols, but there isn't much point to that now. I was leaving them on general principle -- smallest viable change, etc -- but maybe I should just bite the bullet and switch to buffer substrings. Eric ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-06-22 15:45 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20190621205531.14822.22802@vcs0.savannah.gnu.org> [not found] ` <20190621205533.D5EB520A01@vcs0.savannah.gnu.org> 2019-06-21 22:17 ` [Emacs-diffs] scratch/gnus-decoded f041412 1/7: Decode group names in newsrc files as raw-text, not utf-8 Stefan Monnier 2019-06-21 22:55 ` Eric Abrahamsen 2019-06-22 8:20 ` Andreas Schwab 2019-06-22 15:45 ` Eric Abrahamsen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.