tronkko / dirent

C/C++ library for retrieving information on files and directories

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does it support UTF-8 in filenames?

ChrisKozmik opened this issue · comments

Does it support UTF-8 filenames (regardless of OS version and locale settings)?

Do you know if setting locale as UTF-8 would guarantee opendir() (non wide-char version) to work with UTF-8 filenames (it works on my machine)?

std::locale::global(std::locale("LC_CTYPE=.utf8"));

Similarly, does setting locale as UTF-8 would guarantee _wopendir() to work?

Setting locale appears to guarantee that opendir() and fopen() work with UTF-8 file names: Microsoft says that multibyte versions of C runtime functions support UTF-8 after April 2018 update and that you should link statically if you wish to support older window versions. See

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=msvc-160#utf-8-support

Pretty cool!