mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 14:26:06 +02:00
Fix character encoding conversion issues
This commit is contained in:
@ -299,7 +299,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
|
||||
|
||||
core::stringc s;
|
||||
wStringToMultibyte(s, Text.subString(realmbgn, realmend - realmbgn));
|
||||
wStringToUTF8(s, Text.subString(realmbgn, realmend - realmbgn));
|
||||
Operator->copyToClipboard(s.c_str());
|
||||
}
|
||||
break;
|
||||
@ -312,7 +312,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
|
||||
// copy
|
||||
core::stringc sc;
|
||||
wStringToMultibyte(sc, Text.subString(realmbgn, realmend - realmbgn));
|
||||
wStringToUTF8(sc, Text.subString(realmbgn, realmend - realmbgn));
|
||||
Operator->copyToClipboard(sc.c_str());
|
||||
|
||||
if (isEnabled())
|
||||
@ -345,7 +345,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
|
||||
if (p)
|
||||
{
|
||||
irr::core::stringw widep;
|
||||
core::multibyteToWString(widep, p);
|
||||
core::utf8ToWString(widep, p);
|
||||
|
||||
if (MarkBegin == MarkEnd)
|
||||
{
|
||||
@ -1157,7 +1157,7 @@ bool CGUIEditBox::processMouse(const SEvent& event)
|
||||
const c8 *inserted_text_utf8 = Operator->getTextFromPrimarySelection();
|
||||
if (!inserted_text_utf8)
|
||||
return inserted_text;
|
||||
core::multibyteToWString(inserted_text, inserted_text_utf8);
|
||||
core::utf8ToWString(inserted_text, inserted_text_utf8);
|
||||
return inserted_text;
|
||||
}());
|
||||
|
||||
@ -1659,7 +1659,7 @@ void CGUIEditBox::setTextMarkers(s32 begin, s32 end)
|
||||
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
|
||||
|
||||
core::stringc s;
|
||||
wStringToMultibyte(s, Text.subString(realmbgn, realmend - realmbgn));
|
||||
wStringToUTF8(s, Text.subString(realmbgn, realmend - realmbgn));
|
||||
Operator->copyToPrimarySelection(s.c_str());
|
||||
}
|
||||
|
||||
|
@ -673,7 +673,7 @@ bool CIrrDeviceSDL::run()
|
||||
{
|
||||
irrevent.EventType = irr::EET_STRING_INPUT_EVENT;
|
||||
irrevent.StringInput.Str = new core::stringw();
|
||||
irr::core::multibyteToWString(*irrevent.StringInput.Str, SDL_event.text.text);
|
||||
irr::core::utf8ToWString(*irrevent.StringInput.Str, SDL_event.text.text);
|
||||
postEventFromUser(irrevent);
|
||||
delete irrevent.StringInput.Str;
|
||||
irrevent.StringInput.Str = NULL;
|
||||
@ -928,7 +928,7 @@ void CIrrDeviceSDL::sleep(u32 timeMs, bool pauseTimer)
|
||||
void CIrrDeviceSDL::setWindowCaption(const wchar_t* text)
|
||||
{
|
||||
core::stringc textc;
|
||||
core::wStringToMultibyte(textc, text);
|
||||
core::wStringToUTF8(textc, text);
|
||||
SDL_SetWindowTitle(Window, textc.c_str());
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,8 @@ elseif(MSVC)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
add_compile_options(/arch:SSE)
|
||||
endif()
|
||||
|
||||
add_compile_options(/D_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
|
||||
endif()
|
||||
|
||||
# Sanity-check version
|
||||
|
@ -94,7 +94,7 @@ void COSOperator::copyToClipboard(const c8 *text) const
|
||||
EmptyClipboard();
|
||||
|
||||
core::stringw tempbuffer;
|
||||
core::multibyteToWString(tempbuffer, text);
|
||||
core::utf8ToWString(tempbuffer, text);
|
||||
const u32 size = (tempbuffer.size() + 1) * sizeof(wchar_t);
|
||||
|
||||
HGLOBAL clipbuffer;
|
||||
@ -164,7 +164,7 @@ const c8* COSOperator::getTextFromClipboard() const
|
||||
HANDLE hData = GetClipboardData( CF_UNICODETEXT );
|
||||
buffer = (wchar_t*) GlobalLock( hData );
|
||||
|
||||
core::wStringToMultibyte(ClipboardBuf, buffer);
|
||||
core::wStringToUTF8(ClipboardBuf, buffer);
|
||||
|
||||
GlobalUnlock( hData );
|
||||
CloseClipboard();
|
||||
|
Reference in New Issue
Block a user