Skip to content

Conversation

DrakkLord
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant