Strutil utf conversion improvements #3553
Merged
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.
Add
Strutil::utf16_to_utf8(const std::u16string& utf16str)
. This is subtly different from our existing utf16_to_utf8() that takes a std::wstring, because wchar_t is not the same on all platforms. If it really and truly is utf16-in-char16_t, you need this and can't use the utf-in-wchar_t which may be 32 bit chars.Add
Strutil::utf8_to_utf16wstring
(identical to the old utr8_to_utf16) to make it more self-documenting as returning a utf16-encoded wstring and NOT a u16string. Note that wchar_t is not necessarily char16_t on all platforms (it is on Windows, but it's 32 bits on Linux).Deprecate the ambiguously named utf8_to_utf16 for OIIO >= 2.5 and remove it for OIIO >= 3.0.