Thread View: news.software.readers
2 messages
2 total messages
Started by David SHERMAN
Mon, 16 Mar 1992 13:11
Re: Anyone seen Multiple Character Set Support [in NNTP]
Author: David SHERMAN
Date: Mon, 16 Mar 1992 13:11
Date: Mon, 16 Mar 1992 13:11
49 lines
2905 bytes
2905 bytes
In article <martin.699283943@alba>, martin@alba.udac.uu.se (Martin
Wendel) writes:
|> I have been using Keld Simonsen's mnemonic package (as implemented
|> in sendmail-5.65c+IDA-1.4.4) for some time now, and I'm very pleased
|> with the results. Recently I got the idea: why not implement this
|> package in the nntpd?
|>
|> I'm sure everyone who read and post news in languages with fuller
|> character sets than english understands the problem of the present
|> situation.
|>
|> The mnemonic implementation in sendmail uses two extension header
|> lines: X-Charset and X-Char-Esc. Adding those will not violate
|> RFC1036. Articles lacking those will imply ASCII just as in sendmail.
|>
|> As I see it, character set conversion needs to be done in inews and
|> in the nntp server routines that deal with transfer of articles.
|> Along with a host<->charset table conversion can be done for nntp
|> readers and thus also support PC's and Mac's.
|>
|> [etc.]
I, too, am interested in this question. In the domain of NNTP transport,
a cursory reading of rfc977 suggests to me that only commands and responses
need be restricted to 7-bit zero-padded ASCII, and does not preclude 8-bit
data in the article body.
However, the character set translation should be done by the *client*
software on either side, since (again if I understand the definition)
the server is not to attempt to filter the text in any way. Correct
me if I'm wrong. However I would expect the character set translation
to be a client operation in any case, and independant of transport.
At our site, for example, we would add X-Charset:iso-latin-1 and pass
through the 8-bit data for anything with Distribution:local, and only
filter messages destined for outside. Seems reasonable.
Does anyone see a problem with this from the nntp standpoint?
I'm cross-posting to news.software.readers to see what we know
from the standpoint of client software.
Cheers,
djs David J. Sherman (david@geocub.greco-prog.fr)
Laboratoire Bordelais de Recherche en Informatique
De l'incertitude profonde des desseins nai^t une e'tonnante
liberte' de manoeuvre. --Anouilh, /Becket/, Acte III
Re: Anyone seen Multiple Character Set Support [in NNTP]
Author: Martin Wendel
Date: Wed, 18 Mar 1992 08:20
Date: Wed, 18 Mar 1992 08:20
505 lines
16195 bytes
16195 bytes
david@dragon.Greco-Prog.FR (David SHERMAN) writes:
>In article <martin.699283943@alba>, martin@alba.udac.uu.se (Martin
>Wendel) writes:
>|> I have been using Keld Simonsen's mnemonic package (as implemented
>|> in sendmail-5.65c+IDA-1.4.4) for some time now, and I'm very pleased
>|> with the results. Recently I got the idea: why not implement this
>|> package in the nntpd?
>|>
>|> I'm sure everyone who read and post news in languages with fuller
>|> character sets than english understands the problem of the present
>|> situation.
>|>
>|> The mnemonic implementation in sendmail uses two extension header
>|> lines: X-Charset and X-Char-Esc. Adding those will not violate
>|> RFC1036. Articles lacking those will imply ASCII just as in sendmail.
>|>
>|> As I see it, character set conversion needs to be done in inews and
>|> in the nntp server routines that deal with transfer of articles.
>|> Along with a host<->charset table conversion can be done for nntp
>|> readers and thus also support PC's and Mac's.
>|>
>|> [etc.]
>I, too, am interested in this question. In the domain of NNTP transport,
>a cursory reading of rfc977 suggests to me that only commands and responses
>need be restricted to 7-bit zero-padded ASCII, and does not preclude 8-bit
>data in the article body.
>However, the character set translation should be done by the *client*
>software on either side, since (again if I understand the definition)
>the server is not to attempt to filter the text in any way. Correct
>me if I'm wrong. However I would expect the character set translation
>to be a client operation in any case, and independant of transport.
That is a nice thought. But it demands every possible client to
translate character sets, and I don't expect every newsclient maker to
be so swift in implementing it. If clients read news remote via nntp it's
far easier to let the server do the translation.
By the way, a few days ago I came across a patch posted by Pekka Nikander
to extend nntpd to also make the translation. It doesn't use Keld's
extension header lines, but it works. I'll append it below (I had to
do some minor adjustments to get a clean compile, but it's nothing
to worry about):
> Xref: corax.udac.uu.se sfnet.atk.unix:1 news.software.nntp:240 alt.sources:524
> Newsgroups: sfnet.atk.unix,news.software.nntp,alt.sources
> Path: corax.udac.uu.se!sunic!news.funet.fi!fuug!fuug.fi!pnr
> From: pnr@ngs.fi (Pekka Nikander)
> Subject: An attempt to support NNTPD internationalization
> Message-ID: <PNR.91Oct2151141@ngs.fi>
> Sender: usenet@fuug.fi (USENET News System)
> Nntp-Posting-Host: ngs.fi
> Organization: Nixu Oy, Helsinki, Finland
> Date: Wed, 2 Oct 1991 13:11:41 GMT
>
>
> This is my first attempt to support internationalization with NNTPD.
> This patch supports on the fly character set conversions when reading
> or posting news with NNTPD. The patch is based on the BIT8 routines
> and patches by Keld Simonssen for sendmail. You need the BIT8
> routines in order to be able to use these patches. The BIT8 patches
> are available with anonymous FTP from dkuug.dk. Furthermore, they
> come along with sendmail-5.65c+IDA.1.4.4. I have used the version
> provided with sendmail.
> To use these patches:
> 1. Locate your BIT8 patch routines. If you use the sendmail
> distribution, they are in the directory ida/charset.
> This directory will be called BIT8DIR from here on.
> 2. Locate your NNTP source directory. This directory is
> called NNTPDIR from here on.
> 3. Copy strcnv.c and charset.h from BIT8DIR to NNTPDIR/common:
> cp $BIT8DIR/strcnv.c $BIT8DIR/charset.h $NNTPDIR
> 4. Go to BIT8DIR and make install:
> cd $BIT8DIR
> make install
> This will install the character set support files
> into /usr/local/lib/mail/char. You may need to modify Makefile
> or make some directories in order to get this accomplished.
> 5. Go to NNTPDIR and apply this patch:
> cd $NNTPDIR
> patch -p0 < this-article
> I haven't actually tested this step so you may need to apply some
> hunks by hand...
> 6. Check configuration parameters in $NNTPDIR/common/conf.h
> Especially, you probably want to change SERVER_CHSET.
> For proper character set names, see directory /usr/local/lib/mail/char.
> 7. Remake NNTPD
> cd $NNTPDIR
> make server
> 8. Install the new server
> cp /etc/nntpd /etc/nntpd.orig
> cd $NNTPDIR/server
> make install
> 9. Configure your /usr/lib/news/nntp_access file
> The character set is specified as the FIFTH field in the file.
> So, if you previously had
>
> myhost.mydom.fi read post
>
> you should change it into
>
> myhost.mydom.fi read post all LOCAL_CHARSET
>
> where LOCAL_CHARSET is the character set used in the client
> myhost.mydom.fi.
>
> 10. Good luck!
>
> Pekka Nikander Internet: pnr@ngs.fi -or-
> Telecom Finland Pekka.Nikander@ngs.fi
> ----------------------------------------------------------------
*** common/Makefile.orig Wed Oct 2 14:53:04 1991
--- common/Makefile Wed Oct 2 11:48:01 1991
***************
*** 2,9 ****
# Makefile for common directory
#
! SRCS = version.c clientlib.c
! OBJS = version.o clientlib.o
HFILES =
clean:
--- 2,9 ----
# Makefile for common directory
#
! SRCS = version.c clientlib.c strcnv.c
! OBJS = version.o clientlib.o strcnv.o
HFILES =
clean:
*** common/charset.h.orig Wed Oct 2 14:53:44 1991
--- common/charset.h Wed Oct 2 12:12:07 1991
***************
*** 24,29 ****
--- 24,32 ----
** @(#)$Header: /usr/local/src/mail/sendmail/ida/charset/RCS/charset.h,v 2.0 1991/04/05 05:33:29 paul Exp $
*/
+ #ifndef _charset_h_
+ #define _charset_h_
+
/*
* The following 3 parameters may need modifying.
*/
***************
*** 48,50 ****
--- 51,57 ----
OUT_CH *out; /* characters in 8 bit format */
INT16S esc;
};
+
+ extern CHARSET *getchset();
+
+ #endif _charset_h_
*** common/conf.h.orig Wed Oct 2 14:52:46 1991
--- common/conf.h Wed Oct 2 14:49:28 1991
***************
*** 7,12 ****
--- 7,20 ----
* Compile time options.
*/
+ #define BIT8 /* Support for 8 bit character sets and
+ automatic conversion */
+ #ifdef BIT8
+ #define MAPDIR "/usr/local/lib/mail/char"
+ #define SERVER_CHSET "FI"
+ #define NO_XHDR_BIT8 /* Mac TheNews grocks on 8 bits in XHDR reply */
+ #endif
+
#define AUTH /* Define if you want simple authentication */
#undef ALONE /* True if we're running without inetd */
*** common/strcnv.c.orig Wed Oct 2 14:54:03 1991
--- common/strcnv.c Wed Oct 2 12:24:21 1991
***************
*** 25,31 ****
--- 25,47 ----
** Illinois.
*/
+ #ifdef NNTPD
+ #include "../common/conf.h"
+ #include "../common/charset.h"
+ #include "../common/nntp.h"
+ #include <stdio.h>
+ #include <string.h>
+ #include <syslog.h>
+ #define MAXNAME NNTP_STRLEN
+ #define dfopen fopen
+ #define xalloc malloc
+ #define syserr(msg, n) fprintf(stderr, msg, n)
+ #ifndef __STDC__
+ #define const
+ #endif
+ #else
#include "sendmail.h"
+ #endif
#ifdef BIT8
# ifndef lint
***************
*** 263,269 ****
--- 279,289 ----
free(c);
return (NULL);
}
+ #ifdef NNTPD
+ c->name = strdup(s);
+ #else
c->name = newstr(s);
+ #endif
c->in = getinch(s);
c->esc = esc;
if (charsets)
*** server/Makefile.orig Wed Oct 2 11:41:37 1991
--- server/Makefile Wed Oct 2 12:11:16 1991
***************
*** 6,20 ****
ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \
newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \
slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \
! batch.o auth.o timer.o ../common/version.o
SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \
ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \
newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \
slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \
! batch.c auth.c timer.c ../common/version.c
! SRVRINC = common.h ../common/conf.h ../common/nntp.h timer.h
SRCS = ${SRVRSRC}
--- 6,21 ----
ahbs.o globals.o group.o help.o ihave.o list.o misc.o netaux.o \
newgroups.o newnews.o nextlast.o ngmatch.o post.o parsit.o scandir.o \
slave.o spawn.o strcasecmp.o subnet.o time.o xhdr.o fakesyslog.o \
! batch.o auth.o timer.o ../common/version.o ../common/strcnv.o
SRVRSRC = main.c serve.c access.c access_inet.c access_dnet.c active.c \
ahbs.c globals.c group.c help.c ihave.c list.c misc.c netaux.c \
newgroups.c newnews.c nextlast.c ngmatch.c post.c parsit.c scandir.c \
slave.c spawn.c strcasecmp.c subnet.c time.c xhdr.c fakesyslog.c \
! batch.c auth.c timer.c ../common/version.c ../common/strcnv.c
! SRVRINC = common.h ../common/conf.h ../common/nntp.h \
! ../common/charset.h timer.h
SRCS = ${SRVRSRC}
***************
*** 60,62 ****
--- 61,68 ----
../common/version.o:
${CC} ${CFLAGS} -c ../common/version.c
mv version.o ../common/version.o
+
+ ../common/strcnv.o:
+ ${CC} ${CFLAGS} -DNNTPD -c ../common/strcnv.c
+ mv strcnv.o ../common/strcnv.o
+
*** server/access.c.orig Wed Oct 2 11:51:10 1991
--- server/access.c Wed Oct 2 13:55:07 1991
***************
*** 46,51 ****
--- 46,57 ----
extern int Needauth;
#endif AUTH
+
+ #ifdef BIT8
+ CHARSET *client_chset = NULL;
+ CHARSET *server_chset = NULL;
+ #endif
+
host_access(canread, canpost, canxfer, gdlist)
int *canread, *canpost, *canxfer;
char *gdlist;
***************
*** 62,71 ****
--- 68,85 ----
char readperm[MAXBUFLEN];
char postperm[MAXBUFLEN];
char groups[MAXBUFLEN];
+ #ifdef BIT8
+ char charset_name[MAXBUFLEN];
+ #endif
char line[MAXBUFLEN];
register char *cp;
register FILE *acs_fp;
+ #ifdef BIT8
+ if (server_chset == NULL)
+ server_chset = getchset(SERVER_CHSET, 0);
+ #endif
+
gdlist[0] = '\0';
#ifdef DEBUG
***************
*** 162,169 ****
--- 176,191 ----
if (*line == '\0')
continue;
+ #ifdef BIT8
+ count = sscanf(line, "%s %s %s %s %s",
+ hostornet, readperm, postperm, groups,
+ charset_name);
+ if (count < 5)
+ charset_name[0] = '\0';
+ #else
count = sscanf(line, "%s %s %s %s",
hostornet, readperm, postperm, groups);
+ #endif
if (count < 4) {
if (count < 3)
***************
*** 182,187 ****
--- 204,219 ----
*canxfer = *canread = 1;
*canpost = (postperm[0] == 'p' || postperm[0] == 'P');
(void) strcpy(gdlist, groups);
+ #ifdef BIT8
+ if (charset_name[0] != '\0') {
+ #ifdef SYSLOG
+ syslog(LOG_DEBUG,
+ "Charset '%s' specified for '%s'",
+ charset_name, hostname);
+ #endif
+ client_chset = getchset(charset_name, 0);
+ }
+ #endif
break;
}
***************
*** 194,199 ****
--- 226,241 ----
*canxfer = *canread = 1;
*canpost = (postperm[0] == 'p' || postperm[0] == 'P');
(void) strcpy(gdlist, groups);
+ #ifdef BIT8
+ if (charset_name[0] != '\0') {
+ #ifdef SYSLOG
+ syslog(LOG_DEBUG,
+ "Charset '%s' specified for '%s'",
+ charset_name, hostname);
+ #endif
+ client_chset = getchset(charset_name, 0);
+ }
+ #endif
}
if (match != SNETMATCH && (!strcasecmp(hostornet, net_name) ||
***************
*** 206,211 ****
--- 248,263 ----
*canxfer = *canread = 1;
*canpost = (postperm[0] == 'p' || postperm[0] == 'P');
(void) strcpy(gdlist, groups);
+ #ifdef BIT8
+ if (charset_name[0] != '\0') {
+ #ifdef SYSLOG
+ syslog(LOG_DEBUG,
+ "Charset '%s' specified for '%s'",
+ charset_name, hostname);
+ #endif
+ client_chset = getchset(charset_name, 0);
+ }
+ #endif
}
}
/*
*** server/misc.c.orig Wed Dec 12 08:00:11 1990
--- server/misc.c Wed Oct 2 13:55:08 1991
***************
*** 357,362 ****
--- 357,365 ----
int how;
{
char line[NNTP_STRLEN];
+ #ifdef BIT8
+ char line2[NNTP_STRLEN];
+ #endif
register char *cp;
#ifdef LOG
***************
*** 371,376 ****
--- 374,386 ----
while (fgets(line, sizeof(line)-6, fp) != NULL && *line != '\n') {
if (how == BODY) /* We need to skip this anyway */
continue;
+ #ifdef BIT8
+ if (client_chset != NULL) {
+ strncnv(client_chset, server_chset,
+ line2, line, sizeof(line)-6);
+ strncpy(line, line2, sizeof(line)-6);
+ }
+ #endif
cp = index(line, '\n');
if (cp != NULL)
*cp = '\0';
***************
*** 398,403 ****
--- 408,420 ----
}
while (fgets(line, sizeof(line)-6, fp) != NULL) {
+ #ifdef BIT8
+ if (client_chset != NULL) {
+ strncnv(client_chset, server_chset,
+ line2, line, sizeof(line)-6);
+ strncpy(line, line2, sizeof(line)-6);
+ }
+ #endif
cp = index(line, '\n');
if (cp != NULL)
*cp = '\0';
*** server/spawn.c.orig Sat Jan 12 19:25:36 1991
--- server/spawn.c Wed Oct 2 13:55:08 1991
***************
*** 49,54 ****
--- 49,57 ----
char *msg_id;
{
char line[NNTP_STRLEN];
+ #ifdef BIT8
+ char line2[NNTP_STRLEN];
+ #endif
register char *cp;
int i, fd;
int fds[2];
***************
*** 113,118 ****
--- 116,129 ----
if (line[0] == '.' && line[1] == '\0')
break;
+
+ #ifdef BIT8
+ if (client_chset != NULL) {
+ strncnv(server_chset, client_chset,
+ line2, line, sizeof(line));
+ strncpy(line, line2, sizeof(line));
+ }
+ #endif
if (line[0] == '.')
fputs(line+1, fp);
*** server/xhdr.c.orig Wed Oct 2 14:50:26 1991
--- server/xhdr.c Wed Oct 2 14:54:29 1991
***************
*** 139,144 ****
--- 139,147 ----
register char *artname;
{
char line[NNTP_STRLEN];
+ #ifdef BIT8
+ char line2[NNTP_STRLEN];
+ #endif
register char *cp, *cp1;
while (fgets(line, sizeof (line), fp) != NULL) {
***************
*** 152,157 ****
--- 155,169 ----
if (!strcasecmp(header, line)) {
if (cp1 = index(cp + 2, '\n'))
*cp1 = '\0';
+ #ifdef BIT8
+ #ifndef NO_XHDR_BIT8
+ if (client_chset != NULL) {
+ strncnv(client_chset, server_chset,
+ line2, cp + 2, sizeof(line)-6);
+ printf("%s %s\r\n", artname, line2);
+ } else
+ #endif
+ #endif
printf("%s %s\r\n", artname, cp + 2);
return;
}
--
> Pekka Nikander Internet: pnr@ngs.fi -or-
> Helsinki Unixversity of Technology Pekka.Nikander@ngs.fi
--
______________________________________________________________
E-Mail:Martin.Wendel@UDAC.UU.SE ; Snail-Mail: UDAC
Domainmaster@UU.SE Martin Wendel
Postmaster@UU.SE Box 174
Tel: 018 - 18 77 80 S-751 04 Uppsala
Int: +46 18 18 77 80 SWEDEN
Fax: +46 18 51 66 00
______________________________________________________________
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads