Bug 93770 - kmail can't handle multipart messages in some locales (case-conversion problem)
Summary: kmail can't handle multipart messages in some locales (case-conversion problem)
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.7.1
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-23 08:28 UTC by Baris Metin
Modified: 2007-09-14 12:17 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
locale-independent kstricmp function for kdelibs (1.31 KB, patch)
2004-11-23 08:36 UTC, Baris Metin
Details
kdepim patch for kstricmp (19.03 KB, patch)
2004-11-23 08:38 UTC, Baris Metin
Details
locale-independent kasciistricmp function for kdelibs (1.54 KB, patch)
2004-11-23 12:42 UTC, Baris Metin
Details
kmail patch for kasciistricmp (9.50 KB, patch)
2004-11-23 12:43 UTC, Baris Metin
Details
mimelib dw_strasciicasecmp patch (2.92 KB, patch)
2004-11-23 12:44 UTC, Baris Metin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Baris Metin 2004-11-23 08:28:52 UTC
Version:           1.7.1 (using KDE KDE 3.3.1)
Installed from:    Unspecified Linux
Compiler:          gcc (GCC) 3.3.4 
OS:                Linux

In Turkish (and some other like Azeri latin) locale Kmail can't handle multipart messages. If the Content-type header is defined with uppercase letters like this:

Content-Type: MULTIPART/MIXED;
  BOUNDARY="8323328-1440130431-1099506467=:4576"

Kmail simply shows the message as text/plain ignoring the multipart. The 
problematic character is again 'I'. When I change the header, just 
lowercasing the 'I's it works.

Content-Type: MULTiPART/MiXED;
  BOUNDARY="8323328-1440130431-1099506467=:4576"

I think the problematic functions are  in kmail/bodypartformatter.cpp, 
KMail::BodyPartFormatter::createFor( const char * type, const char * 
subtype ) and DwStrcasecmp in mimelib.

    case 'M':
      if ( qstricmp( type, "multipart" ) == 0 )
        return createForMultiPart( subtype );
Comment 1 Baris Metin 2004-11-23 08:34:27 UTC
I've filled two bugs (91089 and 93433) concerning the case-conversion problems in Turkish locales before.

I'll try to explain the problem for Turkish only but, problems arise in 
Turkish (tr_TR, tr_TR.UTF-8), Azeri latin (az_AZ) and newly proposed tr_CY 
locales.

In respect to English's i,I characters Turkish has four characters (i,I,İ,ı) 
lowercase and uppercase forms of dotted and dottless I.

Moreover case-conversion of these characters in Turkish is different than it 
is in English. Uppercasing i produces "I with a dot above" and lowercasing I 
produces "i without the dot above". In fact there is a document (http://www.i18nguy.com/unicode/turkish-i18n.html) describing the situation better than I do.

My first solution was straightforward which simply changes the LC_CTYPE locale to C before the conversion and sets back to system's locale after the conversion. But in kde-devel mailing list David Faure suggested a better solution, "a locale-independent kstricmp function."

As this is a problem for all KDE applications we thought we should place this 
function in kdelibs. And replace problematic qstricmp with it in kdepim/kmail.
Comment 2 Baris Metin 2004-11-23 08:36:58 UTC
Created attachment 8391 [details]
locale-independent kstricmp function for kdelibs

patch adds a new funtion to kdelibs (3.3.1)
Comment 3 Baris Metin 2004-11-23 08:38:14 UTC
Created attachment 8392 [details]
kdepim patch for kstricmp

kdepim patch for using kstricmp.
Comment 4 Ismail Donmez 2004-11-23 10:07:10 UTC
confirming.
Comment 5 David Faure 2004-11-23 10:30:34 UTC
Ingo suggested to rename it to kasciistricmp - and I think this makes sense.
Can you rename it in your patches? I'll then apply them.
Thanks.

Comment 6 Baris Metin 2004-11-23 12:41:26 UTC
Great. Renamed the function and ported to CVS.

I've prepared the mimelib as a separate patch and instead of coping kasciistricmp to dw_mime.cpp, added a new dw_strasciicasecmp function and modified DwStrcasecmp() to use that. I think this is a better way.
Comment 7 Baris Metin 2004-11-23 12:42:32 UTC
Created attachment 8398 [details]
locale-independent kasciistricmp function for kdelibs
Comment 8 Baris Metin 2004-11-23 12:43:20 UTC
Created attachment 8399 [details]
kmail patch for kasciistricmp
Comment 9 Baris Metin 2004-11-23 12:44:34 UTC
Created attachment 8400 [details]
mimelib dw_strasciicasecmp patch
Comment 10 Baris Metin 2004-11-23 12:52:19 UTC
We must also solve bug #91089 for kmail to work and bug #93433 for konqueror to work properly in these locales (tr_TR, tr_TR.UTF-8, az_AZ).
Comment 11 David Faure 2004-11-23 20:55:03 UTC
CVS commit by faure: 

Provide an implementation of kasciistricmp in kdepim, in case CVS-HEAD kdelibs isn't used.
CCBUG: 93770


  A            kasciistricmp.cpp   1.1 [LGPL]
  A            kasciistricmp.h   1.1 [LGPL]
  M +1 -1      Makefile.am   1.6


--- kdepim/libemailfunctions/Makefile.am  #1.5:1.6
@@ -2,5 +2,5 @@
 
 noinst_LTLIBRARIES = libemailfunctions.la
-libemailfunctions_la_SOURCES = email.cpp idmapper.cpp
+libemailfunctions_la_SOURCES = email.cpp idmapper.cpp kasciistricmp.cpp
 libemailfunctions_la_LDFLAGS = $(all_libraries) -no-undefined
 ## Since this is a noinst library, in case of --enable-closure we need


Comment 12 Till Adam 2004-12-14 09:21:18 UTC
Both mimelib and kmail/bodypartformatter.cpp seem fixed. Closing, please re-open if current cvs still makes trouble in this regard.
Comment 13 Baris Metin 2004-12-14 14:20:58 UTC
Yes, this one is fixed.