Summary: | LDIF address book import matches tags case sensitive | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Claws Mail (GTK 2) | Reporter: | Bodo Graumann <mail> | ||||||||
Component: | UI/Address Book | Assignee: | users | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | normal | ||||||||||
Priority: | P3 | ||||||||||
Version: | 3.7.9 | ||||||||||
Hardware: | PC | ||||||||||
OS: | Linux | ||||||||||
Attachments: |
|
Description
Bodo Graumann
2011-08-28 12:30:07 UTC
I am wondering why you chose to use g_utf8_strdown() in the patch rather than g_utf8_casefold()? That has no deeper meaning. I think g_utf8_casefold will work just as well and even be shorter. My first idea was to change the constants in ldif.h to lowercase and only apply g_utf8_strdown to one argument, but now I rather only changed one file. I'm not able to test this, but my patch appears that it would achieve the same result and is a little less cluttered. If you can test it and report back then that would be appreciated. Created attachment 1001 [details]
case insensitive check, patch 2
If I read the documentation correctly even with g_utf8_casefold you would have to apply the conversion on both strings. Thus the only difference is using g_utf8_casefold in place of g_utf8_strdown and there would be the same amount of clutter. Your patch misses to apply g_utf8_casefold to the user-string and won't work. My only reference is http://scentric.net/tutorial/sec-sorting-string-nocase.html, where there is no elaboration on whether any of these two methods is better suited for the job, so I can't say anything about that... If you want less clutter, you could define a function which combines conversion and comparison, but I would not know where claws-mail keeps such functions. > Your patch misses to apply g_utf8_casefold to the user-string and won't work.
g_utf8_strdown() is applied to the string in both sections, (added by my patch to 2nd).
Did you test my patch?
Created attachment 1002 [details]
case insensitive LDIF tag matching in ldif.c, shorter
Ah ok, now I see what you are trying to do. That is of course a good idea. But according to the documentation g_utf8_strdown returns the conversed string and does not do an in place operation. Also you have to either use strdown or casefold in both places, because they are not compatible.
What also wonders me is that there already is a line 'g_utf8_strdown( nm, -1 );' which would not actually do anything. So I'm attaching a new patch, which incorporates your idea.
Changes related to this bug have been committed. Please check latest CVS and update the bug accordingly. You can also get the patch from: http://www.colino.net/claws-mail/ 2011-10-20 [paul] 3.7.10cvs39 * AUTHORS * src/ldif.c * src/gtk/authors.h fix bug 2479, 'LDIF address book import matches tags case sensitive' Patch by Bodo Graumann <mail@bodograumann.de> |