>From: Sam Varshavchik <[hidden email]>
>Sent: Mar 20, 2012 6:55 AM
>To: [hidden email]
>Subject: Re: [sqwebmail] possible bug in folder.c ?
>> -----Original Message-----
>> >From: Sam Varshavchik <[hidden email]>
>> >Sent: Mar 19, 2012 6:47 PM
>> >To: [hidden email]
>> >Subject: Re: [sqwebmail] possible bug in folder.c ?
>> >John writes:
>> >> Actually, INBOX etc had already been read in with getarg, so just
>> >> the line
>> >> origff=ff=folder_fromutf7(f);
>> >> with
>> >> origff=ff=f;
>> >> fixed everything. Thanks.
>> >Sorry, this is wrong.
>> >This is used to decode regular, non-special folder names, which get created
>> >in the maildirs using the modified-UTF7 encoding scheme, for compatibility
>> >with IMAP. Sqwebmail will use modified-UTF7 when creating folders and
>> >maildirs, and convert it back from modified-UTF7 here.
>> >Furthermore, folder_fromutf7 mallocs the returned buffer, which gets freed.
>> >By doing this assignment, you'll end up freeing the same memory twice,
>> >leading to memory corruption.
>> >Instead of
>> >you should use encode the folder name using modified-UTF7. There is not
>> >convenient tool to make this conversion, so you'll have to know what it is,
>> >and use iconv to convert to UTF7, then apply the modified-UTF7 hacks. For
>> >this string, it should probably be:
>> using the line
>> in folder.html, then the inbox is displayed as "邮件夹 - &ZTZO9nux-", which
>> is not right.
>That's probably because you're still using your change. Undo it.
>> I certainly don't want to corrupt memory, although don't quite understand
>> this paragraph: ">Furthermore, folder_fromutf7 mallocs the returned buffer,
>> which gets freed. By doing this assignment, you'll end up freeing the same
>> memory twice, leading to memory corruption." Why origff=ff=f end up freeing
>> the same memory twice?
>Not that statement, but free(origff); below.
>> Or what's the solution to specify Chinese folder
>> name then? If various terms in folder.html have to be specified in
>> different ways, ie, some terms are entered in utf-8, while some others have
>> to be entered in special way, then it would be helpful to have an
>> instruction somewhere?
>It's just never been documented. Documentation exists only if someone writes
>I think this would be the correct change to allow custom names for standard
>folder titles in UTF-8. I haven't tested this myself:
>--- folder.c (revision 192)
>+++ folder.c (working copy)
>@@ -162,6 +162,7 @@
> const char *lab;
> const char *f;
> const char *inbox_lab, *drafts_lab, *trash_lab, *sent_lab;
>@@ -174,10 +175,13 @@
> if (strcmp(f, INBOX) == 0) f=inbox_lab;
> else if (strcmp(f, INBOX "." DRAFTS) == 0) f=drafts_lab;
> else if (strcmp(f, INBOX "." SENT) == 0) f=sent_lab;
> else if (strcmp(f, INBOX "." TRASH) == 0) f=trash_lab;
>+ else in_utf8=0;
> if (lab)
>@@ -185,7 +189,11 @@
> printf("%s", lab);
>+ origff=ff=in_utf8 ?
>+ : folder_fromutf7(f);
> if (strcmp(ff, NEWSHAREDSP) == 0 ||
> strncmp(ff, NEWSHAREDSP ".", sizeof(NEWSHAREDSP)) == 0)
Hi Sam, the patch is clear and works as expected, so this problem is fixed. Thank you.
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
Courier-sqwebmail mailing list
|Free forum by Nabble||Edit this page|