-
Notifications
You must be signed in to change notification settings - Fork 76
Win32 UTF8 Support #68
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
Open
KillerxDBr
wants to merge
38
commits into
tsoding:main
Choose a base branch
from
KillerxDBr:win32_log
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…xists, using ascii versions of some functions
returning zero if file OR dir not found
After some debate with myself. I am convinced that wchar API functions should be used exclusively for the following reasons: - Good Windows programming practice. wchar should be used whenever possible - The rest io interactions uses C standard library, which on windows often can accepts and convert utf-8 string automatically. So I'll argue using ANSI functions is incorrect because library internals (like Nob_Cmd) is assumed to use utf-8 string like what a sane person would do (and also what Linux does). For correctness's sake, the extra memory allocation and conversion is worth it.
Windows Unicode path support
This reverts commit f55ecf3.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR brings full UTF-8 support (i hope) to Windows, by converting the normal Char Strings to Wide Strings and calling the W versions of the Windows API calls.
Thanks to @yhr0x43 (KillerxDBr#1), he/she did almost everything, i just corrected some mistakes, make a better error checking for the Wide String conversions and better error report for minirent functions (and add a fflush to TODO and UNREACHABLE macros).
According to MS in "Use UTF-8 code pages in Windows apps", you can use a manifest to make the ANSI WinApi calls accept UTF-8 (enabled by default in W10 1903 and newer), but its inconsistent (or it just affects the inputs???) since FormatMessageA was returning
??????????
to yhr0x43 , the proper solution is do the conversion using the string apis (MultiByteToWideChar and WideCharToMultiByte).EDIT: I forgot to mention the changes to
nob_mkdir_if_not_exists
andnob_file_exists
other than string conversion, those functions were remade using proper WinApi calls.