Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for UTF-8 on Windows #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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