From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/25186 Path: main.gmane.org!not-for-mail From: Kim-Minh Kaplan Newsgroups: gmane.emacs.gnus.general Subject: [PATCH] [BUG] Binary attachments use wrong encoding (was Re: PDF's as base64 vs. Q/P encoded attachments) Date: Wed, 22 Sep 1999 09:41:33 GMT Organization: SunSITE Denmark (sunsite.auc.dk) Sender: owner-ding@hpc.uh.edu Message-ID: <87d7vbi8qc.fsf@kloug.western.fr> References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1035162619 12701 80.91.224.250 (21 Oct 2002 01:10:19 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:10:19 +0000 (UTC) Return-Path: Original-Received: from bart.math.uh.edu (bart.math.uh.edu [129.7.128.48]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id FAA00536 for ; Wed, 22 Sep 1999 05:46:07 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by bart.math.uh.edu (8.9.1/8.9.1) with ESMTP id EAB13293; Wed, 22 Sep 1999 04:45:58 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Wed, 22 Sep 1999 04:44:04 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id EAA22608 for ; Wed, 22 Sep 1999 04:43:53 -0500 (CDT) Original-Received: from sunsite.auc.dk (sunsite.auc.dk [130.225.51.30]) by sclp3.sclp.com (8.8.5/8.8.5) with SMTP id FAA00522 for ; Wed, 22 Sep 1999 05:41:48 -0400 (EDT) Original-Received: (qmail 17563 invoked by uid 509); 22 Sep 1999 09:41:35 -0000 Original-To: ding@gnus.org Original-Path: not-for-mail Original-Newsgroups: emacs.ding X-Face: C!5Mk_!qB]35}VpD|H>GN/@fk%~7:*/x8&~\]|r|)/zV?rJ){uX4Nh`a$L/z__Kx4Gt!mDU 3kZlj)F2]Ds$?l';SO9]v^|[i2nY`pZ+mu+HT%5ITkuP#e]@8F4@Hc.=]oN1+d\M@Rl>-$C?h$yntf -JVx)3L2}VzG.!bQEy]~I_3fup`HtZ^t/Iz.|Vh$~o`^g\ User-Agent: Gnus/5.070096 (Pterodactyl Gnus v0.96) XEmacs/20.4 (Emerald) Original-Lines: 14 Original-NNTP-Posting-Host: 195.101.52.192 Original-X-Complaints-To: news@sunsite.auc.dk Original-X-Trace: sunsite.auc.dk 937993293 195.101.52.192 (Wed, 22 Sep 1999 11:41:33 MET DST) Original-NNTP-Posting-Date: Wed, 22 Sep 1999 11:41:33 MET DST Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:25186 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:25186 --=-=-= Graham Todd writes: > [...] I think it was decided that if roughly 1/6 of the characters > were non-ASCII, then base64 should be used otherwise Q/P [...] most > PDF's would/should get encoded as base64 wouldn't they? Anyway they > appear ASCIIish to Gnus. There is a bug in the function that chooses between quoted printable and base64. The following patch should fix it. Kim-Minh. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=mm-encode.patch Content-Description: Fix for binary MIME attachments --- mm-encode.el.orig Wed Sep 22 11:31:49 1999 +++ mm-encode.el Wed Sep 22 11:32:41 1999 @@ -126,10 +126,12 @@ (defun mm-qp-or-base64 () (save-excursion - (save-restriction - (narrow-to-region (point-min) (min (+ (point-min) 1000) (point-max))) - (goto-char (point-min)) - (let ((8bit 0)) + (let ((8bit 0) + (start (point-min)) + (end (min (+ (point-min) 1000) (point-max)))) + (narrow-to-region start end) + (goto-char start) + (save-restriction (cond ((not (featurep 'mule)) (while (re-search-forward "[^\x20-\x7f\r\n\t]" nil t) @@ -141,9 +143,9 @@ (unless (eobp) (forward-char 1) (incf 8bit))))) - (if (> (/ (* 8bit 1.0) (buffer-size)) 0.166) + (if (> (/ (* 8bit 1.0) (- end start)) 0.166) 'base64 - 'quoted-printable))))) + 'quoted-printable))))) (provide 'mm-encode) --=-=-=--