[sword-devel] BibleMemorizer and Sword Text Encoding

Joachim Ansorg nospam+sword-devel at joachim-ansorg.de
Wed Dec 27 14:45:16 MST 2006


Hi,

> 	I've had a chance with Christmas break to work on BibleMemorizer, and I've
> made some progress.  However, as Raphaël Pinson (from Ichthux) noted, the
> Sword plugin handles text encoding wrong if the module isn't already in
> UTF-8.  BibleMemorizer itself assumes that any text it gets from plugins is
> UTF-8.  What approach would you suggest for converting the text to UTF-8
> when necessary?  Does Sword 1.5.9 provide such a function, or would I have
> to use something like libiconv?

Create the SWMgr using a SWEncodingMgr object. Create that object using 
something like:
	new sword::EncodingFilterMgr( sword::ENC_UTF8 )

If you want to have keys in UTF8, use the StringMgr class. BibleTime includes 
the class BTStringMgr which is a ready to use implementation using Qt.
For example:
	StringMgr::setSystemStringMgr( new BTStringMgr() );

> 	Also, another tester of BibleMemorizer (Johan van der Lingen) has noticed
> that the Sword plugin will cause slow behavior and hangs when some
> references are inputted wrong, because the plugin (using ListKey to resolve
> references) fetches large ranges, such as entire books.  Also, when a
> reference extends past the end of a chapter, it fetches verses from the
> next chapter.  AFAIK, both of these issues are caused by the normal
> behavior of ListKey.  Is there any more elegant method than ListKey for
> fetching references, or is there an easy way to see how many verses it will
> try to fetch before it fetches them? (see
> http://sourceforge.net/tracker/index.php?func=detail&aid=1579313&group_id=1
>34333&atid=729745 for the bug report in question).

I usually use VerseKey::ParseVerseList with expandRange enabled. Do you set 
that ListKey to the module itself and iterate on the module or do you go 
through the list of refs using the ListKey functions?
I usually use the ListKey functions. 
But whatever you use, you can check in the iteration if more than a few 
chapters are displayed. If that's the case, stop the iteration.

I guess if you turn off AutoNormalization in VerseKey the parsing change the 
upper ref of a range to the next chapter. You can also check using Error() in 
VerseKey for parsing problems, afair.

I hope that all works :)
Joachim
-- 
<>< Re: deemed
www.bibletime.info



More information about the sword-devel mailing list