unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [Unicode-2] `read' always returns multibyte symbol
@ 2007-11-13  9:41 Katsumi Yamaoka
  2007-11-13 12:55 ` Kenichi Handa
  2007-11-13 15:07 ` Stefan Monnier
  0 siblings, 2 replies; 40+ messages in thread
From: Katsumi Yamaoka @ 2007-11-13  9:41 UTC (permalink / raw)
  To: emacs-devel; +Cc: ding

Hi,

The following Lisp snippet emulates what Gnus does when reading
active data for the local.テスト newsgroup.  The buffer contains
data which have been retrieved from the nntp server.  Note that
the newsgroup name contains non-ASCII characters, which has been
encoded by utf-8 in the server.

--8<---------------cut here---------------start------------->8---
(let ((string (encode-coding-string "local.テスト" 'utf-8)))
  (with-temp-buffer
    (set-buffer-multibyte t)
    (insert (string-to-multibyte string))
    (goto-char (point-min))
    (multibyte-string-p (symbol-name (read (current-buffer))))))
--8<---------------cut here---------------end--------------->8---

While Emacs trunk returns nil for this, Emacs Unicode-2 returns t.

If it is not intentional, I hope `read' behaves just like it does
in Emacs trunk.  Otherwise, is there a way to make `read' return
a unibyte symbol (without slowing down)?

In the inside of Gnus, non-ASCII group names are all treated as
unibyte strings, that are the ones that the server has encoded
with certain coding systems.  Because of the present behavior of
`read' in Emacs Unicode-2, Gnus doesn't work with such newsgroups
perfectly.  You can find the actual code in gnus-start.el as
follows:

--8<---------------cut here---------------start------------->8---
;; Read an active file and place the results in `gnus-active-hashtb'.
(defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors
					     real-active)
[...]
	      ;; group gets set to a symbol interned in the hash table
	      ;; (what a hack!!) - jwz
	      (setq group (let ((obarray hashtb)) (read cur)))
--8<---------------cut here---------------end--------------->8---

As you can see, it needs to work fast because there might be a
lot of newsgroups.  So, if possible, I don't want to modify it
into:

--8<---------------cut here---------------start------------->8---
 (setq group (intern (mm-string-as-unibyte (symbol-name (read cur))) hashtb))
--8<---------------cut here---------------end--------------->8---

Regards,



^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2007-12-05 11:26 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-13  9:41 [Unicode-2] `read' always returns multibyte symbol Katsumi Yamaoka
2007-11-13 12:55 ` Kenichi Handa
2007-11-13 15:10   ` Stefan Monnier
2007-11-14  4:53     ` Kenichi Handa
2007-11-14  7:06       ` [Unicode-2] `C-h f' error (was Re: `read' always returns multibyte symbol) Katsumi Yamaoka
2007-11-14 13:01         ` Kenichi Handa
2007-11-15  2:06           ` [Unicode-2] `C-h f' error Katsumi Yamaoka
2007-11-19  8:31             ` Katsumi Yamaoka
2007-11-20 11:09               ` CHENG Gao
2007-11-21 10:55                 ` Katsumi Yamaoka
2007-11-21 12:14                   ` Kenichi Handa
2007-11-21 12:28                     ` Katsumi Yamaoka
2007-11-22  2:27                     ` Richard Stallman
2007-11-22  4:51                       ` Kenichi Handa
2007-11-22 16:22                         ` Richard Stallman
2007-11-23 15:20                     ` Johan Bockgård
2007-11-25 12:35                       ` Kenichi Handa
2007-12-02 21:27                         ` Richard Stallman
2007-12-05  5:11                           ` Kenichi Handa
2007-12-05 11:26                             ` Katsumi Yamaoka
2007-11-25 12:39                       ` Kenichi Handa
2007-11-14  3:56   ` [Unicode-2] `read' always returns multibyte symbol Katsumi Yamaoka
2007-11-14 11:39     ` Katsumi Yamaoka
2007-11-14 14:52       ` Stefan Monnier
2007-11-14 23:52         ` Katsumi Yamaoka
2007-11-15  1:15           ` Stefan Monnier
2007-11-15  3:01             ` Katsumi Yamaoka
2007-11-15  3:39               ` Stefan Monnier
2007-11-15 10:20       ` Katsumi Yamaoka
2007-11-15 11:08         ` Kenichi Handa
2007-11-15 11:41           ` Katsumi Yamaoka
2007-11-15 14:41             ` Kenichi Handa
2007-11-15 23:31               ` Katsumi Yamaoka
2007-11-16  0:51                 ` Kenichi Handa
2007-11-16  1:24                   ` Katsumi Yamaoka
2007-11-16  2:51                     ` Stefan Monnier
2007-11-15 15:22           ` Stefan Monnier
2007-11-16  0:29             ` Kenichi Handa
2007-11-16 10:50             ` Eli Zaretskii
2007-11-13 15:07 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).