[sword-devel] SWORD Engine - critical bugs and pending releases
Matthew Talbert
ransom1982 at gmail.com
Mon Aug 29 13:22:11 MST 2011
> If I could get some code pointers to the unicode solutions built into sword, like
> implementation module(s)?
> example usage?
> tests??
> I'd be willing to try to develop a patch.
In the SWORD source, there is a file tests/filtertest.cpp that shows
how to convert from UTF-8 to UTF-16. However, it should be modified to
cast to wchar_t, which is the same thing on Windows, eg:
wchar_t *wcharBuf = (wchar_t *)lineBuffer.getRawData();
As far as where to start, we need to start by adding a file like the
one I referenced above. The only difference is that we need to do the
UTF-8 -> UTF-16 conversions as I just mentioned, rather than how they
are being done. Once this file is created, then every reference to
those functions in the sword source need to be replaced, eg "open"
needs to be "sw_open". I should point out that on linux, no one really
worries about the underlying issue (which is how to display and choose
filenames that contain characters that don't exist in the system
encoding), so these functions need to have #ifdef's for WIN32. On nix,
they simply need to call the normal functions (open, etc). So, for
example, here's the first function in pseudo-code:
int sw_open(const char *path, int mode, int perms)
{
#ifdef WIN32
SWBuf p;
p.set(path);
UTF8UTF16 filter;
filter.processText(p);
wchar_t *wcharBuf = (wchar_t *)p.getRawData();
return _wopen(wcharBuf, mode, perms);
#else
return open(path, mode, perms);
#endif
}
This code is not tested at all, and I am not a C/C++ expert by any
means. But hopefully that will get you on the right path.
> Also, I'm not sure how I'd most easily reproduce this issue for test purposes on my available machines (Ubuntu and Win Vista) configured for US/English.
You can test by setting the SWORD_PATH environment variable to a
directory containing appropriate characters (eg, Žibřický) and then
running the mgrtest test (in trunk/tests). I'm not familiar with
whether these tests can be compiled easily using Visual Studio,
perhaps someone else can help with that.
> Is it worthwhile for me to look at the Xiphos solution, or is it so tightly coupled with the GLib2 dependency that I'd be better off not?
Perhaps it's worth it, if only to learn where all of the problem areas
are. See http://gnomesword.svn.sourceforge.net/viewvc/gnomesword/branches/webkit/win32/patches/xiphos_sword.patch?revision=4285&view=markup
>
> BTW, I am brand new to the sword project -- only been monitoring sword-devel for a few weeks, just got an account, pmartel60, today, haven't yet read any orientation materials, so don't yet know anything about the development procedures, but I'm a quick study.
>
> If interested, please send any pointers that might be useful.
You might like the wiki, http://www.crosswire.org/wiki/Main_Page, and
the doxygen documentation for SWORD,
http://www.crosswire.org/~ghellings/svnclassdocs/
Hope that helps,
Matthew
More information about the sword-devel
mailing list