Subject: can anybody help me turn of BASE64 ?

From: Andrey V Shain <[email-masked]>
Date: Thu, 19 Dec 1996 02:21:41 +0000

Hello !

Pine send letters in base64
Many peoples have problems when attempt replay on my cyrillic letters.
How can I turn off base64 if it possible ?

            -=<Russian Academy of management and agrobisines>=-
               Andrey V Shain       Chief of computer center
E-mail: [email-masked]              Phohe: +7 (095) 700-0870, 700-0871
        [email-masked]                Fax:   +7 (095) 700-0673, 700-0669

---

From: [email-masked] (Vladimir A. Pertsel)
Date: 24 Dec 1996 16:43:16 GMT

In article <[email-masked]>, Andrey V Shain <[email-masked]> writes:
|> Pine sends letters in base64
|> [...] problems [...] cyrillic letters.
|> How can I turn off base64 if it possible ?

It can be safely done for ISO-8859-5, KOI8-R, CP-1241(MS-Windows 
Russian), but not always for CP-866(MS-DOS Russian)
The same thing solves the problem with Hebrew (ISO-8859-8)

Here is a patch enabling new options, that solve the problem. 
        dont-encode-8bit-text-and-subject,
        dont-encode-text-attachments,
I have taken it from
ftp://ftp.kiae.su/unix/mail/pine3.95-rus-2b.diff.gz
I have tested it on Sun-4.1, Sgi IRIX 4.0.1 and HP-UX 9000/712

The files that are changed, except for LINUX-specific
os-lnx.h and makefile.lnx can be found at
ftp://mail.sagantec.co.il/pub/PackRat/pine3.95.files_changed_for_koi8.tgz (231Kb)

The complete changed source tree ready for compilation at
ftp://mail.sagantec.co.il/pub/russian/pine3.95.with-8-th-bit.tar.gz (2099Kb)

The example of pine.conf, utilising the new options at
ftp://mail.sagantec.co.il/pub/russian/pine3.95-8bit-doc-config.tar.gz (11Kb)

-- 
From the Holy Land, with respect
 /\ /\   Vladimir A. Pertsel            S/W  engineer
((ovo))        E-mail:           \|/   Sagantec Israel
():::() [email-masked] (o o) tel.972-4-8572781
--PVA------------------------ooO-(_)-Ooo------------------ 

diff -rbBc -C 3 pine3.95.orig/pine/init.c pine3.95/pine/init.c
*** pine3.95.orig/pine/init.c	Thu Jul 11 02:05:31 1996
--- pine3.95/pine/init.c	Wed Sep 18 11:33:12 1996
***************
*** 1340,1345 ****
--- 1340,1347 ----
  	{"disable-signature-edit-cmd",		F_DISABLE_SIGEDIT_CMD},
  	{"enable-8bit-esmtp-negotiation",	F_ENABLE_8BIT},
  	{"enable-8bit-nntp-posting",		F_ENABLE_8BIT_NNTP},
+ 	{"dont-encode-8bit-text-and-subject",		F_DONT_ENCODE},
+     {"dont-encode-text-attachments",	F_DONT_ENCODE_TXTATTS},
  	{"enable-aggregate-command-set",	F_ENABLE_AGG_OPS},
  	{"enable-alternate-editor-cmd",		F_ENABLE_ALT_ED},
  	{"enable-alternate-editor-implicitly",	F_ALT_ED_NOW},
diff -rbBc -C 3 pine3.95.orig/pine/makefile.lnx pine3.95/pine/makefile.lnx
*** pine3.95.orig/pine/makefile.lnx	Fri Aug 16 11:56:15 1996
--- pine3.95/pine/makefile.lnx	Wed Aug 14 19:07:51 1996
***************
*** 61,68 ****
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  LIBES=       $(EXTRALIBES) $(LOCLIBES) $(STDLIBES)
  
  STDCFLAGS=   -DLNX -DSYSTYPE=\"LNX\" -DMOUSE
! CFLAGS=      $(OPTIMIZE) $(PROFILE) $(DEBUG) $(EXTRACFLAGS) $(STDCFLAGS)
  
  obj=    addrbook.o adrbklib.o args.o context.o filter.o \
  	folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \
--- 61,69 ----
  LOCLIBES=    $(PICODIR)/libpico.a $(IMAPDIR)/c-client.a
  LIBES=       $(EXTRALIBES) $(LOCLIBES) $(STDLIBES)
  
+ LOCALEFLAGS=	-DLC_COLLATE -DLC_CTYPE
  STDCFLAGS=   -DLNX -DSYSTYPE=\"LNX\" -DMOUSE
! CFLAGS=      $(OPTIMIZE) $(PROFILE) $(DEBUG) $(EXTRACFLAGS) $(STDCFLAGS) $(LOCALEFLAGS)
  
  obj=    addrbook.o adrbklib.o args.o context.o filter.o \
  	folder.o help.o helptext.o imap.o init.o mailcap.o mailcmd.o \
diff -rbBc -C 3 pine3.95.orig/pine/osdep/os-lnx.h pine3.95/pine/osdep/os-lnx.h
*** pine3.95.orig/pine/osdep/os-lnx.h	Fri Aug 16 12:55:37 1996
--- pine3.95/pine/osdep/os-lnx.h	Wed Jun  5 20:13:29 1996
***************
*** 249,255 ****

  /*----------------- locale.h -------------------------------------------*/
! #include <locale.h>  /* To make matching and sorting work right */

--- 249,255 ----

  /*----------------- locale.h -------------------------------------------*/
! /* #include <locale.h>  /* To make matching and sorting work right */

***************
*** 313,324 ****
  /* #include <sgtty.h>      /* BSD-based systems */
  
  /*--------- System V terminal driver -----------------------------------*/
! /* #define HAVE_TERMIO     /* this is for pure System V */
! /* #include <termio.h>     /* Sys V */
  
  /*--------- POSIX terminal driver --------------------------------------*/
! #define HAVE_TERMIOS    /* this is an alternative */
! #include <termios.h>    /* POSIX */

--- 313,324 ----
  /* #include <sgtty.h>      /* BSD-based systems */
  
  /*--------- System V terminal driver -----------------------------------*/
! #define HAVE_TERMIO     /* this is for pure System V */
! #include <termio.h>     /* Sys V */
  
  /*--------- POSIX terminal driver --------------------------------------*/
! /* #define HAVE_TERMIOS    /* this is an alternative */
! /* #include <termios.h>    /* POSIX */

***************
*** 328,334 ****

  /*-------- Use terminfo database instead of termcap --------------------*/
! #define USE_TERMINFO    /* use terminfo instead of termcap */

--- 328,334 ----

  /*-------- Use terminfo database instead of termcap --------------------*/
! /* #define USE_TERMINFO    /* use terminfo instead of termcap */

***************
*** 358,364 ****
  /*----------------------------------------------------------------------
     If no nntp-servers are defined, this program will be used to post news.
   ----*/
! #define SENDNEWS	"/usr/lib/news/inews -h"	/* news posting cmd */

  /*--------- Program employed by users to change their password ---------*/
--- 358,364 ----
  /*----------------------------------------------------------------------
     If no nntp-servers are defined, this program will be used to post news.
   ----*/
! /* #define SENDNEWS	"/usr/local/bin/inews -h"	/* news posting cmd */

  /*--------- Program employed by users to change their password ---------*/
diff -rbBc -C 3 pine3.95.orig/pine/other.c pine3.95/pine/other.c
*** pine3.95.orig/pine/other.c	Thu Jul 11 02:05:59 1996
--- pine3.95/pine/other.c	Tue Sep 17 14:43:04 1996
***************
*** 2484,2489 ****
--- 2484,2493 ----
  	    return(h_config_cruise_mode_delete);
  	  case F_ALLOW_GOTO :
  	    return(h_config_allow_goto);
+ 	  case F_DONT_ENCODE:
+ 	    return(h_config_dont_encode);
+ 	  case F_DONT_ENCODE_TXTATTS:
+ 	    return(h_config_dont_encode_txtatt);
  	  default :
  	    return(NO_HELP);
          }
diff -rbBc -C 3 pine3.95.orig/pine/pine.h pine3.95/pine/pine.h
*** pine3.95.orig/pine/pine.h	Thu Jul 11 21:15:44 1996
--- pine3.95/pine/pine.h	Wed Sep 18 11:36:32 1996
***************
*** 1153,1159 ****
  #define	F_FROM_DELIM_IN_PRINT	   80
  #define	F_BACKGROUND_POST	   81
  #define	F_ALLOW_GOTO		   82
! #define F_LAST_FEATURE		   82		 /* RESET WITH NEW FEATURES */
  
  #if (F_LAST_FEATURE > (LARGEST_BITMAP - 1))
     Whoa!  Too many features!
--- 1153,1161 ----
  #define	F_FROM_DELIM_IN_PRINT	   	80
  #define	F_BACKGROUND_POST	   		81
  #define	F_ALLOW_GOTO		   		82
! #define	F_DONT_ENCODE		   		83
! #define	F_DONT_ENCODE_TXTATTS  		84
! #define F_LAST_FEATURE		   		84		 /* RESET WITH NEW FEATURES */
  
  #if (F_LAST_FEATURE > (LARGEST_BITMAP - 1))
     Whoa!  Too many features!
diff -rbBc -C 3 pine3.95.orig/pine/pine.hlp pine3.95/pine/pine.hlp
*** pine3.95.orig/pine/pine.hlp	Fri Jun 21 03:45:20 1996
--- pine3.95/pine/pine.hlp	Wed Sep 18 11:27:30 1996
***************
*** 363,368 ****
--- 363,370 ----
   o disable-signature-edit-cmd
   o enable-8bit-esmtp-negotiation
   o enable-8bit-nntp-posting
+  o dont-encode-8bit-text-and-subject
+  o dont-encode-text-attachments
   o enable-cruise-mode        (SPACE acts like tab when at end of msg)
   o enable-cruise-mode-delete (look at it once, then it disappears)
   o enable-dot-files          (file browser normally hides dot files)
***************
*** 5478,5483 ****
--- 5480,5507 ----
  characters is to leave Pine's MIME encoding turned on, but recipients
  who lack MIME-aware tools are often annoyed when they receive MIME-encoded 
  messages.
+ 
+ <End of help on this topic>
+ ====== h_config_dont_encode =====
+         FEATURE: dont-encode-8bit-text-and-subject
+ 
+ This feature forces Pine to send message header and body \"as-is\", i.e
+ unencoded, even if it does contain non-ascii characters. This way the 
+ in-country mail goes in former USSR. May be it's against the rules, but...
+ 
+ So, this feature has to be set if you do use Pine within ex-USSR with
+ koi8-r charset. Unset it otherwise...
+ 
+ <End of help on this topic>
+ ====== h_config_dont_encode_txtatt =====
+         FEATURE: dont-encode-text-attachments
+ 
+ This feature forces Pine to send text attachments \"as-is\", i.e
+ unencoded, even if it does contain non-ascii characters. This way the 
+ in-country mail goes in former USSR. May be it's against the rules, but...
+ 
+ So, this feature has to be set if you do use Pine within ex-USSR with
+ koi8-r charset. Unset it otherwise...
  
  <End of help on this topic>
  ====== h_config_tab_new_only =====
diff -rbBc -C 3 pine3.95.orig/pine/send.c pine3.95/pine/send.c
*** pine3.95.orig/pine/send.c	Mon Jul  8 21:10:50 1996
--- pine3.95/pine/send.c	Wed Sep 18 11:49:55 1996
***************
*** 4131,4136 ****
--- 4131,4141 ----
  	 * it from getting encoded in "pine_rfc822_output_body" by
  	 * temporarily inventing a synonym for ENC8BIT...
  	 */
+ 
+ /* Changed for incorporating F_DONT_ENCODE */
+ if (F_OFF(F_DONT_ENCODE, ps_global)){
+ /* */
+ 	
  	if(bp && sending_stream->ok_8bitmime){
  	    int i;
  
***************
*** 4146,4151 ****
--- 4151,4160 ----
  	    }
  	}
  
+ /* End if block for the above change */
+ }
+ /* */
+ 
  	TIME_STAMP("smtp start", 1);
  	if(!error_mess && !smtp_mail(sending_stream, "MAIL",
  				     fake_env ? fake_env : header->env, body)){
***************
*** 4186,4195 ****
--- 4195,4212 ----
  	      error_mess = error_buf;
  	}
  
+ /* Changed for incorporating F_DONT_ENCODE */
+ if (F_OFF(F_DONT_ENCODE, ps_global)){
+ /* */	
+ 
  	/* repair modified "body_encodings" array? */
  	if(bp && sending_stream->ok_8bitmime)
  	  body_encodings[bp->encoding] = NULL;
  
+ /* End if block for the above change */
+ }
+ /* */
+ 
  	TIME_STAMP("smtp closing", 1);
  	smtp_close(sending_stream);
  	sending_stream = NULL;
***************
*** 5497,5504 ****
  
      *(p = tmp) = '\0';
      rfc822_header_line(&p, field, header ? header->env : NULL,
  		       rfc1522_encode(tmp_20k_buf, (unsigned char *) text,
! 				      ps_global->VAR_CHAR_SET));
      return(((writehdr && f) ? (*f)(s, tmp) : 1)
           && ((localcopy && local_so
  	     && !local_written) ? so_puts(local_so,tmp) : 1));
--- 5515,5531 ----
  
      *(p = tmp) = '\0';
      rfc822_header_line(&p, field, header ? header->env : NULL,
+ 
+ /* Changed to disable header encoding */
+ F_OFF(F_DONT_ENCODE, ps_global) ?
+ 
  		       rfc1522_encode(tmp_20k_buf, (unsigned char *) text,
! 				      ps_global->VAR_CHAR_SET)
! 				      
! : text				      );
! /* Changes end here */
! 
! 
      return(((writehdr && f) ? (*f)(s, tmp) : 1)
           && ((localcopy && local_so
  	     && !local_written) ? so_puts(local_so,tmp) : 1));
***************
*** 5540,5548 ****
      }
  
      ptmp	    = alist->personal;	/* remember personal name */
!     alist->personal = rfc1522_encode(tmp_20k_buf,
  				     (unsigned char *) alist->personal,
! 				     ps_global->VAR_CHAR_SET);
      pruned	    = prune_personal(alist, &ch);
      atmp            = alist->next;
      alist->next	    = NULL;		/* digest only first address! */
--- 5567,5584 ----
      }
  
      ptmp	    = alist->personal;	/* remember personal name */
! 
! /* Changed to disable header encoding */
!     alist->personal =
! F_OFF(F_DONT_ENCODE, ps_global) ?
! 
!     				 rfc1522_encode(tmp_20k_buf,
  				     (unsigned char *) alist->personal,
! 				     ps_global->VAR_CHAR_SET)
! 
! : alist->personal;
! /* Changes end here */
! 
      pruned	    = prune_personal(alist, &ch);
      atmp            = alist->next;
      alist->next	    = NULL;		/* digest only first address! */
***************
*** 5617,5625 ****
  
  	tmp[0]		= '\0';
  	ptmp		= alist->personal; /* remember personal name */
! 	alist->personal = rfc1522_encode(tmp_20k_buf,
  					 (unsigned char *) alist->personal,
! 					 ps_global->VAR_CHAR_SET);
  	pruned		= prune_personal(alist, &ch);
  	atmp		= alist->next;
  	alist->next	= NULL;		/* tie off linked list */
--- 5653,5670 ----
  
  	tmp[0]		= '\0';
  	ptmp		= alist->personal; /* remember personal name */
! 
! /* Changed to disable header encoding */
!     alist->personal =
! F_OFF(F_DONT_ENCODE, ps_global) ?
! 
!     				 rfc1522_encode(tmp_20k_buf,
  				     (unsigned char *) alist->personal,
! 				     ps_global->VAR_CHAR_SET)
! 
! : alist->personal;
! /* Changes end here */
! 
  	pruned		= prune_personal(alist, &ch);
  	atmp		= alist->next;
  	alist->next	= NULL;		/* tie off linked list */
***************
*** 6084,6093 ****
--- 6129,6152 ----
  
  	switch (body->encoding) {	/* all else needs filtering */
  	  case ENC8BIT:			/* encode 8BIT into QUOTED-PRINTABLE */
+ 
+ /* Added to allow F_DONT_ENCODE */
+ if (!((body->type == TYPETEXT) && 
+ 	((F_ON(F_DONT_ENCODE, ps_global) && (body->id == NULL)) ||
+ 	(F_ON(F_DONT_ENCODE_TXTATTS, ps_global) && (body->id != NULL)))))
+ /* Changes end here */
+ 
  	    gf_link_filter(gf_8bit_qp);
  	    break;
  
  	  case ENCBINARY:		/* encode binary into BASE64 */
+ 
+ /* Added to allow F_DONT_ENCODE */
+ if (!((body->type == TYPETEXT) && 
+ 	((F_ON(F_DONT_ENCODE, ps_global) && (body->id == NULL)) ||
+ 	(F_ON(F_DONT_ENCODE_TXTATTS, ps_global) && (body->id != NULL)))))
+ /* Changes end here */
+ 
  	    gf_link_filter(gf_binary_b64);
  	    break;
  
***************
*** 6137,6146 ****
  	sprintf (*dst += strlen (*dst),"; %s=",param->attribute);
  	rfc822_cat (*dst,param->value,tspecials);
      } while (param = param->next);
!     else if (body->type == TYPETEXT) strcat (*dst,"; charset=US-ASCII");
      strcpy (*dst += strlen (*dst),"\015\012");
      if (body->encoding)		/* note: encoding 7BIT never output! */
        sprintf (*dst += strlen (*dst), "Content-Transfer-Encoding: %s\015\012",
  	       body_encodings[(body->encoding == ENCBINARY)
  				? ENCBASE64
  				: (body->encoding == ENC8BIT)
--- 6196,6227 ----
  	sprintf (*dst += strlen (*dst),"; %s=",param->attribute);
  	rfc822_cat (*dst,param->value,tspecials);
      } while (param = param->next);
!     else if (body->type == TYPETEXT)
! 
! /* Changed to insert right charset when F_DONT_ENCODE is set */
! {
! /*     	strcat (*dst,"; charset=US-ASCII"); /* The only string from original file */
! 
! 		strcat (*dst,"; charset=");
! 
! 		if (body->encoding && (F_ON(F_DONT_ENCODE, ps_global) && !body->id))
! 			strcat (*dst,ps_global->VAR_CHAR_SET ? ps_global->VAR_CHAR_SET
! 				: (getenv("LANG") ? getenv("LANG") : "koi8-r"));
! 		else
! 			strcat (*dst,"US-ASCII");
! }
! /* Changes end here */
! 
      strcpy (*dst += strlen (*dst),"\015\012");
      if (body->encoding)		/* note: encoding 7BIT never output! */
        sprintf (*dst += strlen (*dst), "Content-Transfer-Encoding: %s\015\012",
+ 
+ /* Added to substitute encoding "8bit" for a text when F_DONT_ENCODE is set */
+ ((F_ON(F_DONT_ENCODE, ps_global) && (body->type == TYPETEXT) && !body->id) ||
+ (F_ON(F_DONT_ENCODE_TXTATTS, ps_global) && (body->type == TYPETEXT) && body->id))
+  	? "8bit" :
+ /* Changes end here */
+ 
  	       body_encodings[(body->encoding == ENCBINARY)
  				? ENCBASE64
  				: (body->encoding == ENC8BIT)
***************
*** 6341,6346 ****
--- 6423,6432 ----
  	     * Fake that we've got clearance from the transport agent
  	     * for 8bit transport for the benefit of our output routines...
  	     */
+ 
+ /* Changed for incorporating F_DONT_ENCODE */
+ if (F_OFF(F_DONT_ENCODE, ps_global)){
+ /* */
  	    if(F_ON(F_ENABLE_8BIT_NNTP, ps_global)
  	       && (bp = first_text_8bit(body))){
  		int i;
***************
*** 6357,6362 ****
--- 6443,6452 ----
  		}
  	    }
  
+ /* End if block for the above change */
+ }
+ /* */
+ 
  	    /*
  	     * Set global header pointer so we can get at it later...
  	     */
***************
*** 6368,6375 ****
--- 6458,6474 ----
  
              smtp_close(sending_stream);
  	    sending_stream = NULL;
+ 
+ /* Changed for incorporating F_DONT_ENCODE */
+ if (F_OFF(F_DONT_ENCODE, ps_global)){
+ /* */	
+ 
  	    if(F_ON(F_ENABLE_8BIT_NNTP, ps_global) && bp)
  	      body_encodings[bp->encoding] = NULL;
+ 
+ /* End if block for the above change */
+ }
+ /* */
  
          } else {
              /*---- Open of NNTP connection failed ------ */