Port from master to RB-2.1 - Fixes Unicode paths on Windows (#1363) #1527
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.
Unlike most other platforms, Windows' Unicode is standardized around
UTF-16, an encoding not compatible with "char *" arrays common in
C/C++. As such, to support Unicode correctly when using Win32 APIs,
strings must be converted to and from UTF-16 and the Unicode
versions of the APIs must be used over the ANSI versions.
This commit introduces the following:
Utility funcions for converting between UTF-8 and UTF-16LE on all
platforms:
Adds test for these conversion functions to ensure the conversion
to and from UTF-8 and UTF-16LE is correct.
Utility wrappers for "std::ifstream" that automatically convert
to and from UTF-16 so that filenames requiring Unicode encoding
function correctly:
Moves the file default compute hash function to the Platform
class (Platform::CreateFileContentHash) and switches to the
Win32 UTF-16 variant on Windows.
Adds the "UNICODE" macro before including "Windows.h" which
ensures all functions called are the Unicode variants instead of
the default ANSI variants.
SetEnvironmentVariable to their Unicode variants.
Changes the following environment variable related functions to
their Win32 Unicode variants on Windows:
Updates tests using SetEnvironmentVariable to use wide string
literals since that function has been switched to the Unicode
variant.
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc itsmattkc@gmail.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com
Signed-off-by: itsmattkc 34096995+itsmattkc@users.noreply.github.com