[sword-devel] possibly bug of Sword 1.5.8 found?
dmsmith555 at gmail.com
Tue Apr 12 16:59:55 MST 2005
Troy A. Griffitts wrote:
> The LD module driver uses a binary search algol to lookup a key. The
> infinite loop suggests that the module is not in alphabetical order.
I don't know if this is your problem or not, but about 2 years ago I ran
across a similar problem and it turned out that the string comparison
was locale sensitive. Some things that I discovered:
Different languages sort accented letters in different orders. Some put
the accented characters before the unaccented characters. Some after.
Some have the accented characters in different orders. The combined oe
and ae have their own rules.
Different languages sort numbers and symbols differently.
Sometimes letter combinations will sort in unexpected locations, e.g. ch
sorts to the beginning of the c's in Spanish (though this seems to be
From this I came to the following concusions:
1) the same collator needs to do the searching as did the sorting.
(Troy, you alluded to this)
2) stored search order does not have to be the same as presentation
order. (If a list is presented to the user, it should be in the order
that they expected)
Our practical solution was to sort using a particular set of rules,
publish those rules and examples of how searching should proceed. And we
built tables per locale that mapped the indexes of the original sort to
another order. With it we could display the results to the user in their
We had several consumers of the sorted text and even with the rules,
they never followed the rules and binary search was broken in ways that
were hard to debug. In each case they consumers came back to us
declaring that we had bad data.
I took a look at zhenglish in JSword and it loads just fine. So it is
possible to read each entry sequentially.
> My first impression is that the bug could be caused by a few things:
> The StringMgr used to read the module alphabetized differently
> than the string functions used to create the module
> The write method is broken, not adding in order correctly.
> The binary search algol is broken.
> Could either of you find a module (preferably one with letters
> that I can read :) ) and exact entry it gets stuck on? Code something
> mod++; // fails here.
> would be great! I'll try to look into the problem if we can nail down
> a case like this. Also please be sure to report what StringMgr you
> are using. Thanks for the report!
Rest deleted ...........
More information about the sword-devel