casouri / xapian-lite

Xapian dynamic module for Emacs
6 stars 2 forks source link

Fix the file path issue on Windows #2

Closed lambertlulala closed 4 months ago

lambertlulala commented 4 months ago

Description

Hello, @casouri

I added some file path conversion for Windows. Actually, Windows machines use ANSI encoding by default instead of UTF-8. Therefore, before converting the path, it checks whether the code page is ANSI (i.e. not 65001, which is utf-8). If so, do the conversion.

The conversion would first convert the path, which is utf-8, to wide string (std::wstring). And then it converts to ANSI string as the parameter to the invocation of stat. After the testing it works well both on my personal machine and working machine.

Would you help review it and merge it if the modification works without issues on your environment?

See https://learn.microsoft.com/zh-tw/windows/win32/intl/code-page-identifiers for details.

casouri commented 4 months ago

It works great! I've merged it. Many thanks!