Re: [evolution-patches] newest patch for fix non rfc2047 compliant i18n mailer
- From: cantona <cantona softhome net>
- To: Not Zed <notzed ximian com>
- Cc: evolution-patches lists ximian com, fejj ximian com
- Subject: Re: [evolution-patches] newest patch for fix non rfc2047 compliant i18n mailer
- Date: Wed, 02 Jun 2004 23:36:34 +0800
On Wed, 2004-06-02 at 19:49 +0800, Not Zed wrote:
>
>
> are you sure this is right? why are the q and b cases different?
> shouldn't they be the same? they should really be the same code
> instance too, they both do basically the same thing.
>
in q case can be =?UTF-7?Q?=E9=98=BF=E9=98=BF=E9=98=BF?=
so it is suppose to be "inptr = strstr(start+1, "=?")" instead of scan
the "?="
in b case it is only can be =?blah?b?blah=?
so "inptr = strstr(start+1, "?=") + 2" is the way
> and you do a lot of strstr - its fairly expensive to keep doing that
> over and over the same string.
>
ok..but it wont save much since there are not much same strstr within
the string. pls tell me if there is good method
> this also will look for broken strings across whitespace, which is an
> even more broken case, but this will break plain strings which don't
> otherwise need encoding.
>
> e.g. what will this do?
>
> =? foo bar
> It will go into the else case, then wont match any of the subcases, it
> will then start scanning backwards until it finds =? -> which might
> clearly go beyond the start of the string! crash!
>
ok, the new patch solved it
> You should definitly not be scanning backwards at all, if you can't
> find ?= anywhere going forward then you certainly dont care if you
> find it goind backwards.
>
> You should also skip things you've already scanned.
>
well since the q case "inptr = strstr(start+1, "=?")"
scan the start of new encode-word, so it is suppose to scan backwords
eg. inptr = "=?UTF-7?Q?=E9=98=BF=E9=98=BF=E9=98=BF?=XXXXXXXX"
and i have no idea about any better method
> And
>
> =? foo bar baz .... ?b?
> will also do weird shit, and
>
> =? foo bar baz ... ?b? balh blah ?=
ok both solved in new patch
> Will also break. I dont think this should be treated as an encoded
> word, even if some mailers write similar crap out to that (i.e.
> embedded whitespace).
>
> So still some issues, its more on the right track though.
I try my best to test all cause that can break
attached the new patch that might solve about the problem of NotZed
represent. If there is still a problem correct me please.
regards,
cantona
? camel/test.c
? shell/shell-errors.xml.h
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2153
diff -u -r1.2153 ChangeLog
--- a/camel/ChangeLog 1 Jun 2004 03:40:24 -0000 1.2153
+++ b/camel/ChangeLog 2 Jun 2004 15:32:52 -0000
@@ -1,3 +1,8 @@
+2004-06-02 Cantona Su <paradisetux hotmail com>
+
+ * camel-mime-utils.c (header_decode_text):
+ Fix non rfc2047 compliant i18n mailer. See #58555
+
2004-05-31 Jeffrey Stedfast <fejj ximian com>
* camel-mime-filter-gzip.c (camel_mime_filter_gzip_finalize):
Index: camel/camel-mime-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-utils.c,v
retrieving revision 1.208
diff -u -r1.208 camel-mime-utils.c
--- a/camel/camel-mime-utils.c 24 May 2004 08:02:10 -0000 1.208
+++ b/camel/camel-mime-utils.c 2 Jun 2004 15:32:54 -0000
@@ -69,7 +69,7 @@
/* for all non-essential warnings ... */
#define w(x)
-#define d(x)
+#define d(x)
#define d2(x)
#define CAMEL_UUENCODE_CHAR(c) ((c) ? (c) + ' ' : '`')
@@ -1130,6 +1130,7 @@
chunk = NULL;
while (inptr < inend) {
+ char *btmp = NULL, *qtmp = NULL;
start = inptr;
while (inptr < inend && camel_mime_is_lwsp(*inptr))
inptr++;
@@ -1142,12 +1143,49 @@
} else {
chunk = start;
}
-
+
+ /* Fix non rfc2047 compliant i18n mailer */
start = inptr;
- while (inptr < inend && !camel_mime_is_lwsp(*inptr))
- inptr++;
-
+ qtmp = strstr(start+1, "=?");
+ btmp = strstr(start+1, "?=");
+
+ if (!(*inptr == '=' && *(inptr+1) == '?')
+ || (*(inptr+2) == '=' || *(inptr+2) == '?')
+ || camel_mime_is_lwsp(*(inptr+2))) {
+ while (inptr < inend && !camel_mime_is_lwsp(*inptr)
+ && !(*(inptr) == '=' && *(inptr+1) == '?'))
+ inptr++;
+ while (inptr < inend && (*(inptr+2) == '=' || *(inptr+2) == '?'
+ || camel_mime_is_lwsp(*(inptr+2))))
+ inptr++;
+ } else if (strstr(start, "=?") && inptr < inend) {
+
+ if (strstr(start, "?B?") || strstr(start, "?b?")) {
+ if (btmp) {
+ inptr = btmp + 2;
+ } else {
+ inptr = inend;
+ }
+
+ while (!(*(inptr-1) == '=' && *(inptr-2) == '?'))
+ inptr--;
+ } else if (strstr(start, "?Q?") || strstr(start, "?q?")) {
+ if (qtmp) {
+ inptr = qtmp;
+ } else {
+ inptr = inend;
+ }
+
+ while (!(*(inptr-1) == '=' && *(inptr-2) == '?'))
+ inptr--;
+ } else {
+ while (inptr < inend && !camel_mime_is_lwsp(*inptr))
+ inptr++;
+ }
+ }
dword = rfc2047_decode_word(start, inptr-start);
+
if (dword) {
g_string_append(out, dword);
g_free(dword);
@@ -1171,7 +1209,7 @@
char *
camel_header_decode_string (const char *in, const char *default_charset)
-{
+{
if (in == NULL)
return NULL;
return header_decode_text (in, strlen (in), default_charset);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]