diff --git a/examples/keyboard/Keyboard.cpp b/examples/keyboard/Keyboard.cpp index ae6fa641d..a1155e607 100644 --- a/examples/keyboard/Keyboard.cpp +++ b/examples/keyboard/Keyboard.cpp @@ -734,7 +734,7 @@ sf::String textEventDescription(const sf::Event::TextEntered& textEntered) text += "\nU+"; std::ostringstream oss; - oss << std::hex << std::setw(4) << std::setfill('0') << textEntered.unicode; + oss << std::hex << std::setw(4) << std::setfill('0') << std::uint32_t{textEntered.unicode}; text += oss.str(); return text; diff --git a/test/System/String.test.cpp b/test/System/String.test.cpp index e505b79dd..996f03b7d 100644 --- a/test/System/String.test.cpp +++ b/test/System/String.test.cpp @@ -29,7 +29,7 @@ auto select(const std::basic_string& string16, const std::basic_string& st auto toHex(const char32_t character) { std::ostringstream stream; - stream << "[\\x" << std::uppercase << std::hex << character << ']'; + stream << "[\\x" << std::uppercase << std::hex << std::uint32_t{character} << ']'; return stream.str(); } } // namespace