Allow using unicode characters in world names regardless of system language on Windows 10 1903 and newer versions #51475
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.
Summary
Bugfixes "Allow using unicode characters in world names regardless of system language on Windows 10 1903 and newer versions"
Purpose of change
Windows by default uses the code page corresponding to the system language as the active code page. Many code pages use charsets that support limited unicode characters. For example, the simplified Chinese charset GBK is missing the copyright symbol "©". So when you try to ridicule Windows by asking it to create a world with the name in the image, it throws a fit and miserably fails.
Describe the solution
According to this article, as of Windows 10 1903 you can use an application manifest to switch an application to the utf-8 code page. For older Windows versions, it falls back to using the default system-language-specific code page, and the game will still work, but only characters in the active code page can be used for world names.
Testing
Created worlds with names containing English, Chinese, the copyright symbol ©, and the cow emoji 🐂 (U+1F402, outside the basic multilingual plane), all of which succeeded. (The font doesn't render the cow emoji correctly though)
Game still runs on Windows XP, but it fails as before when saving/loading files with paths containing characters not in the active code page, as expected.
Additional context
Maybe we can make it fail more gracefully when creating a file with a character not in the active code page on older Windows versions.
As a bonus, the application manifest now makes the crash popup more consistent with the system UI style. It's always more comforting when you see a prettier crash window, I guess.