cppfs icon indicating copy to clipboard operation
cppfs copied to clipboard

Added support for UTF-8 on Windows

Open DrakkLord opened this issue 1 year ago • 0 comments

Added support for UTF-8 strings into windows part of the code:

  • cmake project now has an option OPTION_WINDOWS_UTF8 default ON to enable this feature, if set to OFF then everything works as before my changes
  • all windows file system functions use the ansi or unicode variant based on the above option, if unicode mode is used then the strings sent to the Windows API calls are assumed to be UTF-8 encoded and converted to Windows native unicode format

This effectively allows ( with proper source code file encoding ) for this piece of code to work properly:

int main(int argc, char* argv[]) {
	auto file = cppfs::fs::open("D:\\testá.file");

	printf("File exists: %s\n", file.exists() ? "YES" : "NO");

	printf("DONE\n");
}

it outputs:

File exists: YES
DONE

Tested on:

Windows 11 Pro Version: 23H2 Build: 22631.3880

With latest Visual Studio.

DrakkLord avatar Jul 25 '24 17:07 DrakkLord