[sword-devel] thml2gbf fix

Greg Hellings greg.hellings at gmail.com
Fri May 20 13:28:28 MST 2005


In encoding some ThML files I have to sword format, I discovered a
problem with the thml2gbf utility that comes with Sword.  Whenever an
element tag with two or less characters inside of it (<p>, </p>, <h2>,
</a>, etc.) fell at the end of a line, the converted would place
either one or two "null" characters at the beginning of the following
line, thus causing the chapter in the book I was converting to end
abruptly at that point, although the rest of the data was still in the
.bdt file.

After poking around in the thml2gbf.cpp file, I was able to locate the
source of the problem.  On line 186 it reads:
for (i = 4; i >= 0; i--) {

this ought to read:
for (i = strlen(keybuffer) - 2; i >= 0; i--) {

When this happens, then the file appears to be correctly translated.

Thanks!

--Greg



More information about the sword-devel mailing list