Repository navigation
Enforce consistent handling of (wx)string encoding - #1808
Merged
Merged
Conversation
Essentially we want to be using UTF-8 encoded std::strings everywhere possible (and on all platforms), only converting from/to wxString when dealing with wx functions. - Set wxNO_IMPLICIT_WXSTRING_ENCODING to ensure we never implicitly convert from/to wxString (without this it would be very difficult to find everywhere this happens) - When converting from std::string to wxString, always use wxString::FromUTF8() - When converting from wxString to std::string, always use wxString::utf8_string() - When constructing wxString from a string literal, use the wxS() macro around the literal to convert to wchar_t if necessary (on Windows wxString is UTF-16 internally) This should fix all issues with file paths containing unicode characters (and hopefully stop these reoccurring in the future)
Using wxNO_IMPLICIT_WXSTRING_ENCODING causes build errors within wx when using wx3.2 for some reason. Also, apparently wx3.3 adds a string_view version of wxString::FromUTF8, but as it isn't in 3.2 we still need wxutil::strFromView
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
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.
Essentially we want to be using UTF-8 encoded std::strings everywhere possible (and on all platforms), only converting from/to wxString when dealing with wx functions.
wxNO_IMPLICIT_WXSTRING_ENCODINGto ensure we never implicitly convert from/to wxString (without this it would be very difficult to find everywhere this happens)wxString::FromUTF8()wxString::utf8_string()wxS()macro around the literal to convert to wchar_t if necessary (on Windows wxString is UTF-16 internally)This should fix all issues with file paths containing unicode characters (and hopefully stop these reoccurring in the future)
Fix #1765
Fix #1589
Fix #1702