xapian-core and Windows non-ASCII paths

Jean-Francois Dockes jf at dockes.org
Thu Jun 4 11:49:58 BST 2020


Hi,

I am attaching a patch against the xapian-core 1.4 branch.

On Windows with MSVC (probably mingw too but I did not test), it allows
xapian-core to create and use an index located at a path containing arbitrary
Unicode characters. As far as I could see, this does not work with the
current code, and, from the question I asked on xapian-discuss nobody seems
to have an obvious external solution for the issue.

The idea of the patch is that a conversion to a Windows Unicode wide char
string is attempted prior to performing a relevant system call. If the
conversion succeeds, the wide version of the call is used, else, the
previous narrow call is used. This should ensure that  existing
applications are undisturbed, and provides a way to tunnel a Unicode path
by using utf-8.

I am not claiming that the patch should be merged as is.

An obvious defect is that you may want to test for an ASCII path (in which
case the conversion succeeds but is wasteful). Also, location of the
conversion routine, style, etc. may not be appropriate. And there are
probably changes missing in untested parts, e.g. xapian-compact.

However it shows the appropriate system call changes and fixes the issue
for me, so I guess it maybe useful for somebody else.

Cheers,

jf

-------------- next part --------------
A non-text attachment was scrubbed...
Name: xapian-1.4-wchar.diff
Type: application/octet-stream
Size: 11464 bytes
Desc: not available
URL: <http://lists.xapian.org/pipermail/xapian-devel/attachments/20200604/d29da9c1/attachment.obj>


More information about the Xapian-devel mailing list