Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gnus-group-browse-foreign-server doesn't work

1 view
Skip to first unread message

Simon Josefsson

unread,
Oct 5, 2001, 1:04:43 PM10/5/01
to Per Abrahamsen, The Gnus Bugfixing Girls + Boys
Per Abrahamsen <abr...@dina.kvl.dk> writes:

> Oort Gnus v0.04
> GNU Emacs 21.0.105.1 (i686-pc-linux-gnu, X toolkit)
> of 2001-08-28 on ssv2
> 200 sunsite.dk InterNetNews NNRP server INN 2.3.1 ready (posting ok).
>
> Here is the bug I get with
>
> B nntp <ret> news.uni-stuttgart.de <ret>
>
> in the *Groups* buffer.
>
> Debugger entered--Lisp error: (wrong-type-argument stringp ("1a.greenville.classes" 68 . 140))
> string-match(".*" ("1a.greenville.classes" 68 . 140))
> gnus-browse-foreign-server((nntp "news.uni-stuttgart.de"))
> gnus-group-browse-foreign-server((nntp "news.uni-stuttgart.de"))
> call-interactively(gnus-group-browse-foreign-server)

I can't reproduce this. Has this gone away?

Per Abrahamsen

unread,
Oct 6, 2001, 12:16:01 PM10/6/01
to Simon Josefsson, The Gnus Bugfixing Girls + Boys
Simon Josefsson <j...@extundo.com> writes:

> I can't reproduce this. Has this gone away?

The bug was triggered by a non-nil 'gnus-group-name-charset-group-alist'.

I have commited this patch. The code attempted to display newsgroup
names with the correct character set, with the fix it works. This
means dk.test.זרו is showned correctly when browsing sunsite.dk. Now
we just need native group names to be shown correctly :-)

2001-10-06 Per Abrahamsen <abr...@dina.kvl.dk>

* gnus-srvr.el (gnus-browse-foreign-server): Fixed bug non-nil
'gnus-group-name-charset-group-alist'.

*** gnus-srvr.el.~6.15.~ Thu Sep 20 13:59:41 2001
--- gnus-srvr.el Sat Oct 6 18:06:21 2001
***************
*** 729,735 ****
(let ((buffer-read-only nil) charset)
(while groups
(setq group (car groups))
! (setq charset (gnus-group-name-charset method group))
(gnus-add-text-properties
(point)
(prog1 (1+ (point))
--- 729,735 ----
(let ((buffer-read-only nil) charset)
(while groups
(setq group (car groups))
! (setq charset (gnus-group-name-charset method (car group)))
(gnus-add-text-properties
(point)
(prog1 (1+ (point))

Simon Josefsson

unread,
Oct 6, 2001, 12:51:01 PM10/6/01
to Per Abrahamsen, The Gnus Bugfixing Girls + Boys
Per Abrahamsen <abr...@dina.kvl.dk> writes:

> Simon Josefsson <j...@extundo.com> writes:
>
>> I can't reproduce this. Has this gone away?
>
> The bug was triggered by a non-nil 'gnus-group-name-charset-group-alist'.
>
> I have commited this patch. The code attempted to display newsgroup
> names with the correct character set, with the fix it works. This
> means dk.test.זרו is showned correctly when browsing sunsite.dk. Now
> we just need native group names to be shown correctly :-)

The following takes care of the last thing. Cool, I now get UTF-8 in
server buffer, in group buffer, in summary mode line. Not in the
Newsgroups header though. Shouldn't be too difficult.

But this is a sort of cludgy solution, shouldn't Gnus really treat
NNTP traffic as UTF-8 directly? Or is the NNTP protocol still just
8-bit clean, and only the group names are to be treated as UTF-8?

2001-10-06 Simon Josefsson <j...@extundo.com>

* gnus-group.el (gnus-group-line-format-alist): Decode group names.

--- gnus-group.el.~6.40.~ Sun Sep 30 12:21:43 2001
+++ gnus-group.el Sat Oct 6 18:46:57 2001
@@ -468,7 +468,10 @@
(?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
(?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
(gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
- (?g gnus-tmp-group ?s)
+ (?g (gnus-group-name-decode gnus-tmp-group
+ (gnus-group-name-charset
+ gnus-tmp-method gnus-tmp-group))
+ ?s)
(?G gnus-tmp-qualified-group ?s)
(?c (gnus-short-group-name gnus-tmp-group) ?s)
(?D gnus-tmp-newsgroup-description ?s)

Simon Josefsson

unread,
Oct 6, 2001, 1:11:16 PM10/6/01
to Per Abrahamsen, The Gnus Bugfixing Girls + Boys
Simon Josefsson <j...@extundo.com> writes:

>>> I can't reproduce this. Has this gone away?
>>
>> The bug was triggered by a non-nil 'gnus-group-name-charset-group-alist'.
>>
>> I have commited this patch. The code attempted to display newsgroup
>> names with the correct character set, with the fix it works. This
>> means dk.test.זרו is showned correctly when browsing sunsite.dk. Now
>> we just need native group names to be shown correctly :-)
>
> The following takes care of the last thing. Cool, I now get UTF-8 in
> server buffer, in group buffer, in summary mode line. Not in the
> Newsgroups header though. Shouldn't be too difficult.

Try this, now UTF-8 group names seem to work everywhere except you get
a warning from Gnus when posting. Shouldn't be too difficult to fix,
either.

--- gnus-art.el.~6.109.~ Fri Sep 28 19:35:00 2001
+++ gnus-art.el Sat Oct 6 19:09:37 2001
@@ -638,7 +638,8 @@
(face :value default)))))

(defcustom gnus-article-decode-hook
- '(article-decode-charset article-decode-encoded-words)
+ '(article-decode-charset article-decode-encoded-words
+ article-decode-group-name)
"*Hook run to decode charsets in articles."
:group 'gnus-article-headers
:type 'hook)
@@ -1753,6 +1754,21 @@
(save-restriction
(article-narrow-to-head)
(funcall gnus-decode-header-function (point-min) (point-max)))))
+
+(defun article-decode-group-name ()
+ "Decode group names in `Newsgroups:'."
+ (let ((inhibit-point-motion-hooks t)
+ buffer-read-only)
+ (save-restriction
+ (article-narrow-to-head)
+ (nnheader-replace-header "Newsgroups"
+ (gnus-group-name-decode
+ (string-make-unibyte
+ (mail-fetch-field "Newsgroups"))
+ (gnus-group-name-charset
+ (gnus-find-method-for-group
+ gnus-newsgroup-name)
+ gnus-newsgroup-name))))))

(defun article-de-quoted-unreadable (&optional force read-charset)
"Translate a quoted-printable-encoded article.

Per Abrahamsen

unread,
Oct 6, 2001, 1:15:25 PM10/6/01
to Simon Josefsson, The Gnus Bugfixing Girls + Boys
Simon Josefsson <j...@extundo.com> writes:

> The following takes care of the last thing. Cool, I now get UTF-8 in
> server buffer, in group buffer, in summary mode line. Not in the
> Newsgroups header though. Shouldn't be too difficult.

It is pretty important, if the newsgroup header isn't showing the
right (utf-8) name, followups won't work. I have to edit the
newsgroup line each time I followup in dk.test.utf8.æøå when using
gnus-group-name-charset-group-alist.

> But this is a sort of cludgy solution, shouldn't Gnus really treat
> NNTP traffic as UTF-8 directly? Or is the NNTP protocol still just
> 8-bit clean, and only the group names are to be treated as UTF-8?

Standardwise, NNTP is 8-bit clean, and UTF8 is the only legal
character set in the headers (other chracter sets must be rfc2047
encoded, making them ascii). However, the body can be any character
set

In practise, we probably want to distinguish between the newsgroup
header and the rest for a while longer (as Gnus already does). Raw
Latin-1 in headers is still common.

I'd like to change the default for gnus-group-name-charset-group-alist
to

(if (and (fboundp 'coding-system-p) (coding-system-p 'utf-8))
'((".*" . utf-8))
nil)

Is that all right?

Per Abrahamsen

unread,
Oct 6, 2001, 1:23:58 PM10/6/01
to Simon Josefsson, The Gnus Bugfixing Girls + Boys
Cool! Will you commit it?

Simon Josefsson

unread,
Oct 6, 2001, 1:32:29 PM10/6/01
to Per Abrahamsen, The Gnus Bugfixing Girls + Boys
Per Abrahamsen <abr...@dina.kvl.dk> writes:

> Cool! Will you commit it?

`string-make-unibyte' is probably Emacs specific and horrible as well,
and the code didn't handle different charset for different groups
within the same Newsgroups: header so I made the following up instead.

If you say this works, I'll commit it.

--- gnus-art.el.~6.109.~ Fri Sep 28 19:35:00 2001

+++ gnus-art.el Sat Oct 6 19:31:35 2001


@@ -638,7 +638,8 @@
(face :value default)))))

(defcustom gnus-article-decode-hook
- '(article-decode-charset article-decode-encoded-words)
+ '(article-decode-charset article-decode-encoded-words
+ article-decode-group-name)
"*Hook run to decode charsets in articles."
:group 'gnus-article-headers
:type 'hook)

@@ -1753,6 +1754,25 @@


(save-restriction
(article-narrow-to-head)
(funcall gnus-decode-header-function (point-min) (point-max)))))
+
+(defun article-decode-group-name ()
+ "Decode group names in `Newsgroups:'."
+ (let ((inhibit-point-motion-hooks t)
+ buffer-read-only

+ (method (gnus-find-method-for-group gnus-newsgroup-name)))
+ (when (and (or gnus-group-name-charset-method-alist
+ gnus-group-name-charset-group-alist)
+ (gnus-buffer-live-p gnus-original-article-buffer))
+ (nnheader-replace-header
+ "Newsgroups"
+ (mapconcat (lambda (group)
+ (gnus-group-name-decode group (gnus-group-name-charset
+ method group)))
+ (message-tokenize-header
+ (with-current-buffer gnus-original-article-buffer
+ (mail-fetch-field "Newsgroups"))
+ ", ")
+ ", ")))))

Simon Josefsson

unread,
Oct 6, 2001, 1:40:08 PM10/6/01
to Per Abrahamsen, The Gnus Bugfixing Girls + Boys
Per Abrahamsen <abr...@dina.kvl.dk> writes:

> Simon Josefsson <j...@extundo.com> writes:
>
>> The following takes care of the last thing. Cool, I now get UTF-8 in
>> server buffer, in group buffer, in summary mode line. Not in the
>> Newsgroups header though. Shouldn't be too difficult.
>
> It is pretty important, if the newsgroup header isn't showing the
> right (utf-8) name, followups won't work. I have to edit the
> newsgroup line each time I followup in dk.test.utf8.æøå when using
> gnus-group-name-charset-group-alist.

You get UTF-8 in the Newsgroups: line with the previous patch, but the
followup code does it's own parsing of the Newsgroups: line so it
doesn't work there yet though. Should be fixed by duplicating the
same code there.

You still get two warnings when posting though, first that the group
is unknown (comparison should be against encoded names, not raw vs
encoded) and that the header line looks "funny" (it probably looks for
non-ascii).

>> But this is a sort of cludgy solution, shouldn't Gnus really treat
>> NNTP traffic as UTF-8 directly? Or is the NNTP protocol still just
>> 8-bit clean, and only the group names are to be treated as UTF-8?
>
> Standardwise, NNTP is 8-bit clean, and UTF8 is the only legal
> character set in the headers (other chracter sets must be rfc2047
> encoded, making them ascii). However, the body can be any character
> set
>
> In practise, we probably want to distinguish between the newsgroup
> header and the rest for a while longer (as Gnus already does). Raw
> Latin-1 in headers is still common.

Ah, ok. So the change in USEFOR is only to make newsgroup names
UTF-8. Good. That makes things easier.

> I'd like to change the default for gnus-group-name-charset-group-alist
> to
>
> (if (and (fboundp 'coding-system-p) (coding-system-p 'utf-8))
> '((".*" . utf-8))
> nil)
>
> Is that all right?

Works for me.

Maybe it should be documented that the default way of sending
non-ASCII group names from backends into Gnus is by using unibyte
UTF-8 (which is a little ugly, but what the heck).

Per Abrahamsen

unread,
Oct 7, 2001, 9:06:57 AM10/7/01
to
Simon Josefsson <j...@extundo.com> writes:

> You still get two warnings when posting though, first that the group
> is unknown (comparison should be against encoded names, not raw vs
> encoded) and that the header line looks "funny" (it probably looks for
> non-ascii).

Did you fix the first warning?

The second warning is from the code in rfc2047.el. The obvious
solution would be to just skip get/set/query, and encode
unconditionally for null methods. However, there might be a reason
for the current code. Than again all you get if you answer "no" is an
error.

Should I remove it? Ah, well, the question is really very confusing,
I'll comment the code out. If this was an error, I apologize in
advance.

Simon Josefsson

unread,
Oct 7, 2001, 9:33:19 AM10/7/01
to Per Abrahamsen, bu...@gnus.org
Per Abrahamsen <abr...@dina.kvl.dk> writes:

> Simon Josefsson <j...@extundo.com> writes:
>
>> You still get two warnings when posting though, first that the group
>> is unknown (comparison should be against encoded names, not raw vs
>> encoded) and that the header line looks "funny" (it probably looks for
>> non-ascii).
>
> Did you fix the first warning?

Yes.

> The second warning is from the code in rfc2047.el.

Actually it was from message.el, search for "odd".

You still get it if you post from non-UTF8 enabled Emacsen, which is
probably as good as it can get.

> The obvious solution would be to just skip get/set/query, and encode
> unconditionally for null methods. However, there might be a reason
> for the current code. Than again all you get if you answer "no" is
> an error.
>
> Should I remove it? Ah, well, the question is really very confusing,
> I'll comment the code out. If this was an error, I apologize in
> advance.

I think the code is there for interaction with non-Gnus stuff, M-x
mail for instance. In most cases if you get to that question, the
caller is buggy or non-MIME aware and encoding anyway might not be
right. But I dunno.

Per Abrahamsen

unread,
Oct 7, 2001, 9:56:30 AM10/7/01
to Simon Josefsson, bu...@gnus.org
Simon Josefsson <j...@extundo.com> writes:

> Actually it was from message.el, search for "odd".

Ok, then it was a different warning I got (I use BCC, you use GCC).

0 new messages