[sword-devel] Windows Unicode
Greg Hellings
greg.hellings at gmail.com
Mon Jan 6 19:31:48 MST 2020
A long, long time ago I took over building a MinGW Sword package build for
Fedora in order to enable cross-compiling Xiphos for Windows machines.
In so doing I also adopted a patch against Sword that Xiphos keeps in its
tree. This is due to a bug (feature? Let's just go with "limitation") in
the C APIs on Windows. The bug, if memory serves, is that calling basic
file functions in C (fopen, etc) only supports arguments in cp1252/ASCII.
So any users who have usernames with non-CP1252 characters are left unable
to run Sword without custom pointing to a SWORD_HOME that is outside of
their user directory. The solution is to use Windows API calls and pass in
data in UTF-16, or whatever encoding is in vogue on Windows these days.
Xiphos' solution was to just substitute out calls to the file functions
with calls to the glib wrapped file functions. Glib is mature enough to
have worked around this Windows quirk and can take the UTF-8/16 data and
call the appropriate methods in the Windows API that are required for such
paths (Linux handles non-ASCII characters in the path with fopen and its
siblings without any hiccups. It's not a compiler bug, either - it lives
somewhere deep inside of the system library in Windows itself). This
solution works great for Xiphos, which already depends on Glib as part of
the GTK stack but it results in my Windows editions of the utils being
inflated by also carrying the full Glib/pango/etc stack just to work around
this one small (but major) issue.
The patch against 1.8.1 released code lives here:
https://src.fedoraproject.org/rpms/mingw-sword/blob/master/f/xiphos_sword.patch
Is there any chance we can get a mainline Sword solution to this bug so
that Bible Time, The SWORD Project for Windows, and any others are not
impacted by this going forward? With the talk about 1.9 going on, I figured
this would be a good time to poke this bear. Also, it might be that Windows
fixed this in Windows 10, but it was still in Windows 8.1 the last time I
checked, and it dates back to the early days of Win32 APIs, so I doubt that.
--Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20200106/ccfe0d7d/attachment.html>
More information about the sword-devel
mailing list