From matthias.andree@web.de  Mon Sep 16 02:46:23 2002
Return-Path: <matthias.andree@web.de>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 348E737B400
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Sep 2002 02:46:23 -0700 (PDT)
Received: from mail.dt.e-technik.uni-dortmund.de (krusty.dt.E-Technik.uni-dortmund.de [129.217.163.1])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 72CFB43E65
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Sep 2002 02:46:22 -0700 (PDT)
	(envelope-from matthias.andree@web.de)
Received: from m2a2.myip.org (localhost [127.0.0.1])
	by mail.dt.e-technik.uni-dortmund.de (Postfix) with ESMTP id 4E35BA3831
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Sep 2002 11:46:20 +0200 (CEST)
Received: from libertas.emma.line.org (libertas.emma.line.org [192.168.0.2])
	by merlin.emma.line.org (Postfix) with ESMTP id A60C3911
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Sep 2002 11:46:16 +0200 (CEST)
Received: from libertas.emma.line.org (localhost [127.0.0.1])
	by libertas.emma.line.org (8.12.6/8.12.6) with ESMTP id g8G9kG6H000297
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 16 Sep 2002 11:46:16 +0200 (CEST)
	(envelope-from emma@libertas.emma.line.org)
Received: (from emma@localhost)
	by libertas.emma.line.org (8.12.6/8.12.6/Submit) id g8G9kDDR000296;
	Mon, 16 Sep 2002 11:46:13 +0200 (CEST)
Message-Id: <200209160946.g8G9kDDR000296@libertas.emma.line.org>
Date: Mon, 16 Sep 2002 11:46:13 +0200 (CEST)
From: Matthias Andree <matthias.andree@web.de>
Reply-To: Matthias Andree <matthias.andree@web.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Pan breaks MIME charset headers (FreeBSD specific) 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         42825
>Category:       ports
>Synopsis:       Pan breaks MIME charset headers (FreeBSD specific)
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    gnome
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 16 02:50:03 PDT 2002
>Closed-Date:    Mon Sep 16 19:55:21 PDT 2002
>Last-Modified:  Mon Sep 16 19:55:21 PDT 2002
>Originator:     Matthias Andree
>Release:        FreeBSD 4.7-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD libertas.emma.line.org 4.7-PRERELEASE FreeBSD 4.7-PRERELEASE #1: Sat Sep 14 04:14:33 CEST 2002 toor@libertas.emma.line.org:/usr/src/sys/compile/LIBERTAS i386


	
>Description:
When Pan is used in localized environments, say, German, it emits
BROKEN character set declarations in postings. It writes headers like these:

MIME-Version: 1.0
Content-Type: text/plain; charset=iso8859-15

It should have written ...charset=iso-8859-15 instead. (mind the dash).

This must be attributed to FreeBSD's horrendously wrong decision to use X11
character set names for localization, which breaks compatibility, and harms
portability.

Impact: Pan postings don't get the non-ASCII characters of ISO 8859 right.
This leads to a mutilation of the article display in other software.
	
>How-To-Repeat:
	
>Fix:
Solutions:

* fix FreeBSD to use proper locale names

* failing that, add code to Pan (backport from Pan2 which does the right
thing?) to normalize these charset declarations from FreeBSD's locale to use
IANA- registered charset names instead.

* remove the Pan port (not recommended)
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->gnome 
Responsible-Changed-By: roam 
Responsible-Changed-When: Mon Sep 16 02:59:52 PDT 2002 
Responsible-Changed-Why:  
Over to the maintainer group. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42825 

From: Joe Marcus Clarke <marcus@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, matthias.andree@web.de
Cc:  
Subject: Re: ports/42825: Pan breaks MIME charset headers (FreeBSD specific)
Date: 16 Sep 2002 16:08:44 -0400

 Can you try the attached patch, and let me know if it works?  Thanks.
 
 Joe
 
 --- gmime/gmime-charset.c.orig	Mon Sep 16 16:07:29 2002
 +++ gmime/gmime-charset.c	Mon Sep 16 16:07:36 2002
 @@ -69,7 +69,7 @@
  		 * codeset  is  a  character  set or encoding identifier like
  		 * ISO-8859-1 or UTF-8.
  		 */
 -		char *codeset, *p;
 +		char *codeset, *p, *tmp;
  		
  		codeset = strchr (locale, '.');
  		if (codeset) {
 @@ -77,6 +77,16 @@
  			
  			/* ; is a hack for debian systems and / is a hack for Solaris systems */
  			for (p = codeset; *p && !strchr ("@;/", *p); p++);
 +
 +			if (strstr(codeset, "iso") != NULL &&
 +			    strlen(codeset) > 3) {
 +			    tmp = (char *)g_malloc(strlen(codeset) + 1);
 +			    strcpy(tmp, "iso");
 +			    strcat(tmp, "-");
 +			    strcat(tmp, (codeset + 3));
 +			    codeset = tmp;
 +			    g_free(tmp);
 +			}
  			locale_charset = g_strndup (codeset, (unsigned) (p - codeset));
  			g_strdown (locale_charset);
  		} else {
 -- 
 Joe Marcus Clarke
 FreeBSD GNOME Team	::	marcus@FreeBSD.org
 http://www.FreeBSD.org/gnome
 

From: Matthias Andree <matthias.andree@stud.uni-dortmund.de>
To: Joe Marcus Clarke <marcus@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org, matthias.andree@web.de
Subject: Re: ports/42825: Pan breaks MIME charset headers (FreeBSD specific)
Date: Tue, 17 Sep 2002 00:40:50 +0200

 I hacked upon the previous patch and another one I was sent in private
 mail, and this one finally works for me:
 
 --- gmime/gmime-charset.c.orig	Tue Dec 18 21:09:40 2001
 +++ gmime/gmime-charset.c	Tue Sep 17 00:34:46 2002
 @@ -69,15 +69,25 @@
  		 * codeset  is  a  character  set or encoding identifier like
  		 * ISO-8859-1 or UTF-8.
  		 */
 -		char *codeset, *p;
 +		char *codeset, *tmp = NULL;
  		
  		codeset = strchr (locale, '.');
  		if (codeset) {
  			codeset++;
  			
 +			if (strncasecmp(codeset, "iso", 3) == 0 &&
 +			    strlen(codeset) > 3 && 
 +			    strncasecmp(codeset, "iso-", 4) != 0) {
 +			    tmp = (char *)g_malloc(strlen(codeset) + 2);
 +			    strcpy(tmp, "iso");
 +			    strcat(tmp, "-");
 +			    strcat(tmp, (codeset + 3));
 +			    codeset = tmp;
 +			}
 +
  			/* ; is a hack for debian systems and / is a hack for Solaris systems */
 -			for (p = codeset; *p && !strchr ("@;/", *p); p++);
 -			locale_charset = g_strndup (codeset, (unsigned) (p - codeset));
 +			locale_charset = g_strndup (codeset, strcspn(codeset, "@;/"));
 +			if (tmp) g_free(tmp);
  			g_strdown (locale_charset);
  		} else {
  			/* charset unknown */
State-Changed-From-To: open->closed 
State-Changed-By: marcus 
State-Changed-When: Mon Sep 16 19:54:57 PDT 2002 
State-Changed-Why:  
Fixed.  Thanks for your help and for reporting. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=42825 
>Unformatted:
