hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.1k stars 359 forks source link

Support Unicode-filenames on Windows #195

Open Fedr opened 3 years ago

Fedr commented 3 years ago

Currently libconfig functions take (const char *) arguments for file names and call fopen(...) function inside. This is perfectly right in Linux world where strings are stored in UTF-8, but unfortunately, this way does not support arbitrary non-ASCII characters in filenames on Windows. See http://utf8everywhere.org/ for details.

Could you please add some support for Windows as well. For example, if you accept filenames as std::filesystem::path, this will work perfectly. Or please implement any other method suggested in http://utf8everywhere.org/

hyperrealm commented 1 year ago

I don't have access to a Windows system at this time. If someone who does could create a patch to add this, I'd appreciate it.

nenin-sc commented 1 year ago

It is possible to use windows native wide string functions (_wfopen?) to get FILE handle and then use it in Config methods void read (FILE * stream) void write (FILE * stream) const Of course, it might have some portability footprint.