From 73b8ba9e4ec054610d345a89f931ab22957207a9 Mon Sep 17 00:00:00 2001 From: kaetemi Date: Sun, 1 Nov 2020 11:37:22 +0800 Subject: [PATCH] UTF-8 various, ryzom/ryzomcore#335 --- nel/include/nel/gui/view_text_id.h | 2 +- nel/src/gui/view_text_id.cpp | 4 +-- .../src/interface_v3/action_handler_help.cpp | 22 ++++++------ .../src/interface_v3/action_handler_item.cpp | 25 +++++++------- .../src/interface_v3/action_handler_misc.cpp | 4 +-- .../interface_v3/action_handler_phrase.cpp | 4 +-- .../src/interface_v3/action_phrase_faber.cpp | 8 ++--- .../bot_chat_page_create_guild.cpp | 6 ++-- .../src/interface_v3/bot_chat_page_trade.cpp | 12 +++---- .../src/interface_v3/chat_text_manager.cpp | 6 ++-- .../src/interface_v3/chat_text_manager.h | 1 - ryzom/client/src/interface_v3/chat_window.cpp | 9 +---- ryzom/client/src/interface_v3/chat_window.h | 3 -- .../client/src/interface_v3/dbctrl_sheet.cpp | 16 ++++----- ryzom/client/src/interface_v3/dbctrl_sheet.h | 2 +- .../src/interface_v3/dbgroup_build_phrase.cpp | 4 +-- .../dbgroup_list_sheet_icon_phrase.cpp | 4 +-- .../interface_v3/dbgroup_list_sheet_mission.h | 2 +- ...roup_list_sheet_text_brick_composition.cpp | 16 ++++----- .../dbgroup_list_sheet_text_phrase.cpp | 4 +-- .../interface_v3/dbgroup_list_sheet_trade.cpp | 2 +- .../interface_v3/dbgroup_list_sheet_trade.h | 2 +- .../client/src/interface_v3/group_career.cpp | 2 +- .../client/src/interface_v3/group_compas.cpp | 4 +-- .../interface_v3/group_in_scene_bubble.cpp | 6 ++-- .../interface_v3/group_in_scene_user_info.cpp | 20 +++++------ ryzom/client/src/interface_v3/group_map.cpp | 2 +- .../group_phrase_skill_filter.cpp | 6 ++-- .../client/src/interface_v3/guild_manager.cpp | 2 +- .../client/src/interface_v3/interface_ddx.cpp | 4 +-- ryzom/client/src/interface_v3/interface_ddx.h | 2 +- .../src/interface_v3/interface_manager.cpp | 34 +++++++++---------- .../src/interface_v3/interface_manager.h | 10 +++--- .../src/interface_v3/item_special_effect.cpp | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 10 +++--- .../src/interface_v3/people_interraction.cpp | 8 ++--- .../src/interface_v3/sbrick_manager.cpp | 2 +- .../src/interface_v3/sphrase_manager.cpp | 6 ++-- ryzom/client/src/r2/editor.cpp | 6 ++-- ryzom/client/src/zone_util.cpp | 8 ++--- ryzom/common/src/game_share/character_title.h | 4 +-- ryzom/common/src/game_share/utils.h | 9 +++-- 42 files changed, 148 insertions(+), 157 deletions(-) diff --git a/nel/include/nel/gui/view_text_id.h b/nel/include/nel/gui/view_text_id.h index 292f1728a..d29721481 100644 --- a/nel/include/nel/gui/view_text_id.h +++ b/nel/include/nel/gui/view_text_id.h @@ -39,7 +39,7 @@ namespace NLGUI public: virtual ~IOnReceiveTextId() {} // the deriver may change the input text - virtual void onReceiveTextId(ucstring &str) =0; + virtual void onReceiveTextId(std::string &str) =0; }; // *************************************************************************** diff --git a/nel/src/gui/view_text_id.cpp b/nel/src/gui/view_text_id.cpp index 61d97b523..bea55a04d 100644 --- a/nel/src/gui/view_text_id.cpp +++ b/nel/src/gui/view_text_id.cpp @@ -231,9 +231,7 @@ namespace NLGUI // Modify the text? if (_StringModifier) { - ucstring tmp = ucstring::makeFromUtf8(result); - _StringModifier->onReceiveTextId(tmp); // FIXME: UTF-8 - result = tmp.toUtf8(); + _StringModifier->onReceiveTextId(result); } // Set the Text diff --git a/ryzom/client/src/interface_v3/action_handler_help.cpp b/ryzom/client/src/interface_v3/action_handler_help.cpp index 9cad50e25..102307909 100644 --- a/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -2104,9 +2104,7 @@ void getItemText (CDBCtrlSheet *item, string &itemText, const CItemSheet*pIS) INVENTORIES::TInventory inventory = (INVENTORIES::TInventory)item->getInventoryIndex(); sint32 slot = item->getIndexInDB(); string debugText = NLMISC::toString("inventory: %s\nslot: %d\n", INVENTORIES::toString(inventory).c_str(), slot); - ucstring debugText2; - debugText2.fromUtf8(debugText); - itemText = debugText2 + itemText; + itemText = debugText + itemText; #endif } @@ -2536,10 +2534,10 @@ void refreshItemHelp(CSheetHelpSetup &setup) // itemText += CI18N::get("uiRingPlotItemDesc"); // itemText += mi->Description.empty() ? CI18N::get("uiRingPlotItemEmpty") // : mi->Description; -// //itemText += ucstring("\n@{6F6F}") + CI18N::get("uiRingPlotItemComment") + ucstring("\n"); +// //itemText += "\n@{6F6F}" + CI18N::get("uiRingPlotItemComment") + "\n"; // /* // itemText += mi->Comment.empty() ? CI18N::get("uiRingPlotItemEmpty") -// : (ucstring("\n") + mi->Comment); +// : ("\n" + mi->Comment); // */ // } // } @@ -2761,9 +2759,9 @@ void refreshMissionHelp(CSheetHelpSetup &setup, const CPrerequisitInfos &infos) // *************************************************************************** class CPlayerShardNameRemover : public IOnReceiveTextId { - virtual void onReceiveTextId(ucstring &str) + virtual void onReceiveTextId(std::string &str) { - str= CEntityCL::removeShardFromName(str.toUtf8()); + str= CEntityCL::removeShardFromName(str); } }; static CPlayerShardNameRemover PlayerShardNameRemover; @@ -2968,7 +2966,7 @@ void getSabrinaBrickText(CSBrickSheet *pBR, string &brickText) if( pBR->getSkill()==SKILLS::unknown ) { string::size_type pos0= brickText.find(killSkill); - if(pos0 != ucstring::npos) + if(pos0 != string::npos) { string::size_type pos1= brickText.find(killSkill, pos0 + killSkill.size() ); if(pos1 != string::npos) @@ -3668,7 +3666,7 @@ public: } } - ucstring str; + string str; BOMB_IF( minTimeRemaining < 0, "at least one animal should be dead", return; ); str += CI18N::get("uittAnimalDeadPopupToolTip"); @@ -3676,7 +3674,7 @@ public: str += toString(minTimeRemaining); // replace the context help that is required. - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER( CHandlerAnimalDeadPopupTooltip, "animal_dead_popup_tooltip"); @@ -3800,13 +3798,13 @@ static void onMpChangeItemPart(CInterfaceGroup *wnd, uint32 itemSheetId, const s CViewText *viewText= dynamic_cast(groupMp->getElement(groupMp->getId()+":text" )); if(viewText) { - ucstring mpCraft; + string mpCraft; // add the Origin filter. string originFilterKey= "iompf" + ITEM_ORIGIN::enumToString((ITEM_ORIGIN::EItemOrigin)itemPart.OriginFilter); mpCraft+= CI18N::get(originFilterKey); - viewText->setText(mpCraft.toUtf8()); + viewText->setText(mpCraft); } diff --git a/ryzom/client/src/interface_v3/action_handler_item.cpp b/ryzom/client/src/interface_v3/action_handler_item.cpp index 1f8cd61b0..cdd47be2a 100644 --- a/ryzom/client/src/interface_v3/action_handler_item.cpp +++ b/ryzom/client/src/interface_v3/action_handler_item.cpp @@ -141,14 +141,14 @@ void CInterfaceItemEdition::CItemEditionWindow::infoReceived() } else { - ucstring customText; + string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText; - strFindReplace(customText, "%mfc", ucstring()); + customText = itemInfo.CustomText.toUtf8(); // TODO: UTF-8 (serial) + strFindReplace(customText, "%mfc", string()); } - editBoxShort->setInputStringAsUtf16(customText); + editBoxShort->setInputString(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -263,14 +263,14 @@ void CInterfaceItemEdition::CItemEditionWindow::begin() else { - ucstring customText; + string customText; if (!itemInfo.CustomText.empty()) { - customText = itemInfo.CustomText; - strFindReplace(customText, "%mfc", ucstring()); + customText = itemInfo.CustomText.toUtf8(); + strFindReplace(customText, "%mfc", string()); } - editBoxShort->setInputStringAsUtf16(customText); + editBoxShort->setInputString(customText); editShort->setActive(true); editBoxShort->setActive(true); @@ -407,11 +407,11 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() if (group && editShort && editBoxShort && editLarge && editBoxLarge && display && editButtons && closeButton && background) { bool textValid = editShort->getActive(); - ucstring text = editBoxShort->getInputStringAsUtf16(); + string text = editBoxShort->getInputString(); if (!textValid) { textValid = editLarge->getActive(); - text = editBoxLarge->getInputStringAsUtf16(); + text = editBoxLarge->getInputString(); } if (textValid) @@ -428,7 +428,8 @@ void CInterfaceItemEdition::CItemEditionWindow::validate() out.serial(uiInventory); uint32 uiSlot = (uint32)pCSItem->getIndexInDB(); out.serial(uiSlot); - out.serial(text); + ucstring ucText = ucstring::makeFromUtf8(text); // TODO: UTF-8 (serial) + out.serial(ucText); NetMngr.push(out); //nlinfo("impulseCallBack : %s %s %d \"%s\" sent", msgName.c_str(), INVENTORIES::toString((INVENTORIES::TInventory)pCSItem->getInventoryIndex()).c_str(), pCSItem->getIndexInDB(), text.toUtf8().c_str()); } @@ -2123,7 +2124,7 @@ class CHandlerItemMenuCheck : public IActionHandler { std::string name = groupNames[i]; std::string ahParams = "name=" + name; - //Use ucstring because group name can contain accentued characters (and stuff like that) + //Use utf-8 string because group name can contain accentued characters (and stuff like that) pGroupMenu->addLine(name, "", "", name); CGroupSubMenu* pNewSubMenu = new CGroupSubMenu(CViewBase::TCtorParam()); pGroupMenu->setSubMenu(pGroupMenu->getNumLine()-1, pNewSubMenu); diff --git a/ryzom/client/src/interface_v3/action_handler_misc.cpp b/ryzom/client/src/interface_v3/action_handler_misc.cpp index 73c967bcb..b9c71bc56 100644 --- a/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -924,8 +924,8 @@ bool CStringPostProcessRemoveName::cbIDStringReceived(string &inOut) inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(strNewTitle, Woman); { // Sometimes translation contains another title - ucstring::size_type pos = inOut.find('$'); - if (pos != ucstring::npos) + string::size_type pos = inOut.find('$'); + if (pos != string::npos) { inOut = STRING_MANAGER::CStringManagerClient::getTitleLocalizedName(CEntityCL::getTitleFromName(inOut), Woman); } diff --git a/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 16a65e336..489dcbc35 100644 --- a/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1692,7 +1692,7 @@ public: if(!ctrlSheet) return; - ucstring str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId()))); + string str(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(CSheetId(ctrlSheet->getSheetId()))); // According to locked state if(ctrlSheet->getGrayed()) @@ -1700,7 +1700,7 @@ public: else strFindReplace(str, "%comp", CI18N::get("uittPhraseCombatRestrictOK")); - CWidgetManager::getInstance()->setContextHelpText(str.toUtf8()); + CWidgetManager::getInstance()->setContextHelpText(str); } }; REGISTER_ACTION_HANDLER( CHandlerCombatRestrictTooltip, "phrase_combat_restrict_tooltip"); diff --git a/ryzom/client/src/interface_v3/action_phrase_faber.cpp b/ryzom/client/src/interface_v3/action_phrase_faber.cpp index 47fda6d00..f23152b8a 100644 --- a/ryzom/client/src/interface_v3/action_phrase_faber.cpp +++ b/ryzom/client/src/interface_v3/action_phrase_faber.cpp @@ -510,7 +510,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick CViewText *viewText= dynamic_cast(itemReqLineGroup->getView(FaberPhraseText)); if(viewText) { - ucstring text; + string text; if(mpBuild.RequirementType==CMPBuild::ItemPartReq) { text= CI18N::get("uihelpFaberMpHeader"); @@ -524,7 +524,7 @@ void CActionPhraseFaber::validateFaberPlanSelection(CSBrickSheet *itemPlanBrick { nlstop; } - viewText->setText( text.toUtf8() ); + viewText->setText(text); } // Set as Icon the required MP FaberType / or Sheet Texture (directly...) @@ -1687,7 +1687,7 @@ void CActionPhraseFaber::updateItemResult() CViewText *successView= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(FaberPhraseFpSuccessText)); if(successView) { - ucstring text= CI18N::get("uiPhraseFaberSuccessRate"); + string text= CI18N::get("uiPhraseFaberSuccessRate"); // Get the success rate of the related phrase uint phraseSlot= pPM->getMemorizedPhrase(_ExecuteFromMemoryLine, _ExecuteFromMemoryIndex); @@ -1725,7 +1725,7 @@ void CActionPhraseFaber::updateItemResult() + "@{FFFF})"; } strFindReplace(text, "%success", successStr ); - successView->setTextFormatTaged(text.toUtf8()); + successView->setTextFormatTaged(text); } diff --git a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp index 143a71837..649f2bd16 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_create_guild.cpp @@ -71,10 +71,10 @@ class CHandlerGuildCreate : public IActionHandler CGroupEditBox *pDesc = dynamic_cast(CWidgetManager::getInstance()->getElementFromId(guildDescWin)); - ucstring guildName = pGEB->getInputStringAsUtf16(); + ucstring guildName = pGEB->getInputStringAsUtf16(); // FIXME: UTF-8 (serial) - ucstring guildDesc; - if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); + ucstring guildDesc; // FIXME: UTF-8 (serial) + if (pDesc != NULL) guildDesc = pDesc->getInputStringAsUtf16(); // FIXME: UTF-8 (serial) uint64 icon = CGuildManager::iconMake((uint8)pCS->getGuildBack(), (uint8)pCS->getGuildSymbol(), pCS->getInvertGuildSymbol(), pCS->getGuildColor1(), pCS->getGuildColor2()); diff --git a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp index 13e60fff8..2725eedc9 100644 --- a/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp +++ b/ryzom/client/src/interface_v3/bot_chat_page_trade.cpp @@ -1011,9 +1011,9 @@ void CBotChatPageTrade::startSellDialog(CDBCtrlSheet *sheet, CCtrlBase * /* pCal CViewText *itemNameView = dynamic_cast(ig->getView("object_name")); if (itemNameView) { - ucstring itemName; + string itemName; itemName = sheet->getItemActualName(); - itemNameView->setText(itemName.toUtf8()); + itemNameView->setText(itemName); } // set help for item @@ -1678,16 +1678,16 @@ void CBotChatPageTrade::setupFactionPointPrice(bool /* sellMode */, uint default CViewText *vt= dynamic_cast(fpGroup->getView("unit_price_header")); if(vt) { - ucstring fmt= CI18N::get("uiUnitFPPrice"); + string fmt= CI18N::get("uiUnitFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt.toUtf8()); + vt->setText(fmt); } vt= dynamic_cast(fpGroup->getView("total_price_header")); if(vt) { - ucstring fmt= CI18N::get("uiTotalFPPrice"); + string fmt= CI18N::get("uiTotalFPPrice"); strFindReplace(fmt, "%fac", factionName); - vt->setText(fmt.toUtf8()); + vt->setText(fmt); } // setup icon according to pvp clan diff --git a/ryzom/client/src/interface_v3/chat_text_manager.cpp b/ryzom/client/src/interface_v3/chat_text_manager.cpp index 3e99cd8b5..eb79f4211 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.cpp +++ b/ryzom/client/src/interface_v3/chat_text_manager.cpp @@ -156,14 +156,14 @@ static CInterfaceGroup *buildLineWithCommand(CInterfaceGroup *commandGroup, CVie return group; } -static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstring::size_type textSize) +static inline bool isUrlTag(const string &s, string::size_type index, string::size_type textSize) { // Format http://, https:// // or markdown style (title)[http://..] if(textSize > index+7) { bool markdown = false; - ucstring::size_type i = index; + string::size_type i = index; // advance index to url section if markdown style link is detected if (s[i] == '(') { @@ -188,7 +188,7 @@ static inline bool isUrlTag(const ucstring &s, ucstring::size_type index, ucstri if (textSize > i + 7) { - bool isUrl = (toLower(s.substr(i, 7)) == ucstring("http://") || toLower(s.substr(i, 8)) == ucstring("https://")); + bool isUrl = (toLower(s.substr(i, 7)) == "http://" || toLower(s.substr(i, 8)) == "https://"); // match "text http://" and not "texthttp://" if (isUrl && i > 0 && !markdown) { diff --git a/ryzom/client/src/interface_v3/chat_text_manager.h b/ryzom/client/src/interface_v3/chat_text_manager.h index 1cf66730e..2cc71dd0e 100644 --- a/ryzom/client/src/interface_v3/chat_text_manager.h +++ b/ryzom/client/src/interface_v3/chat_text_manager.h @@ -30,7 +30,6 @@ namespace NLGUI class CInterfaceGroup; } -class ucstring; namespace NLMISC{ class CCDBNodeLeaf; } diff --git a/ryzom/client/src/interface_v3/chat_window.cpp b/ryzom/client/src/interface_v3/chat_window.cpp index 816a2016a..e1667839d 100644 --- a/ryzom/client/src/interface_v3/chat_window.cpp +++ b/ryzom/client/src/interface_v3/chat_window.cpp @@ -351,13 +351,6 @@ void CChatWindow::setCommand(const std::string &command, bool execute) _EB->setCommand(command, execute); } -void CChatWindow::setCommand(const ucstring &command,bool execute) -{ - if (!_EB) return; - _EB->setCommand(command.toUtf8(), execute); -} - - //================================================================================= void CChatWindow::setEntry(const string &entry) { @@ -624,7 +617,7 @@ void CChatGroupWindow::displayMessage(const string &msg, NLMISC::CRGBA col, CCha prefix = (title.empty() ? "" : " ") + title; pos = newmsg.find("] "); - if (pos == ucstring::npos) + if (pos == string::npos) newmsg = prefix + newmsg; else newmsg = newmsg.substr(0, pos) + prefix + newmsg.substr(pos); diff --git a/ryzom/client/src/interface_v3/chat_window.h b/ryzom/client/src/interface_v3/chat_window.h index 9a299ebfb..88104e4f9 100644 --- a/ryzom/client/src/interface_v3/chat_window.h +++ b/ryzom/client/src/interface_v3/chat_window.h @@ -23,7 +23,6 @@ #ifndef CL_CHAT_WINDOW_H #define CL_CHAT_WINDOW_H -#include "nel/misc/ucstring.h" // REMOVE #include "nel/misc/smart_ptr.h" #include "game_share/chat_group.h" @@ -109,8 +108,6 @@ public: void enableBlink(uint numBlinks); // set a command to be displayed and eventually executed in this chat window. std::string version for backward compatibility void setCommand(const std::string &command, bool execute); - // set a command to be displayed and eventually executed in this chat window - void setCommand(const ucstring &command, bool execute); // REMOVE // set a string to be displayed in the edit box of this window (if it has one) void setEntry(const std::string &entry); // Set listener to react to a chat entry diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp index dcfdc1fc9..ee01fc913 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.cpp +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.cpp @@ -1665,7 +1665,7 @@ void CDBCtrlSheet::setupSBrick () } // *************************************************************************** -void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bricks, const ucstring &phraseName) +void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bricks, const string &phraseName) { CSBrickManager *pBM = CSBrickManager::getInstance(); @@ -1718,7 +1718,7 @@ void CDBCtrlSheet::setupDisplayAsPhrase(const std::vector &bri { // Compute the text from the phrase only if needed // string iconName= phraseName.toString(); - string iconName= phraseName.toUtf8(); + const string &iconName = phraseName; if( _NeedSetup || iconName != _OptString ) { // recompute text @@ -1741,7 +1741,7 @@ void CDBCtrlSheet::setupSPhrase() CSPhraseSheet *pSPS = dynamic_cast(SheetMngr.get(CSheetId(sheet))); if (pSPS && !pSPS->Bricks.empty()) { - const ucstring phraseName(STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet))); + const char *phraseName = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedName(CSheetId(sheet)); setupDisplayAsPhrase(pSPS->Bricks, phraseName); } else @@ -1799,7 +1799,7 @@ void CDBCtrlSheet::setupSPhraseId () } else { - setupDisplayAsPhrase(phrase.Bricks, phrase.Name); + setupDisplayAsPhrase(phrase.Bricks, phrase.Name.toUtf8()); // FIXME: UTF-8 (serial) } } @@ -3512,11 +3512,11 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const game = game["game"]; game.callMethodByNameNoThrow("updatePhraseTooltip", 1, 1); // retrieve result from stack - ucstring tmpHelp; + ucstring tmpHelp; // FIXME: Lua UTF-8 if (!ls->empty()) { CLuaIHM::pop(*ls, tmpHelp); // FIXME: Lua UTF-8 - help = tmpHelp.toUtf8(); + help = tmpHelp.toUtf8(); // FIXME: Lua UTF-8 } else { @@ -3537,10 +3537,10 @@ void CDBCtrlSheet::getContextHelp(std::string &help) const if (phraseSheetID != 0) { // is it a built-in phrase? - ucstring desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)); + string desc = STRING_MANAGER::CStringManagerClient::getSPhraseLocalizedDescription(NLMISC::CSheetId(phraseSheetID)); if (!desc.empty()) { - help += ucstring("\n\n@{CCCF}") + desc; + help += "\n\n@{CCCF}" + desc; } } */ diff --git a/ryzom/client/src/interface_v3/dbctrl_sheet.h b/ryzom/client/src/interface_v3/dbctrl_sheet.h index dfe3b7140..a26a74b22 100644 --- a/ryzom/client/src/interface_v3/dbctrl_sheet.h +++ b/ryzom/client/src/interface_v3/dbctrl_sheet.h @@ -626,7 +626,7 @@ protected: // optSheet is for special faber void setupDisplayAsSBrick(sint32 sheet, sint32 optSheet= 0); // setup icon from phrases - void setupDisplayAsPhrase(const std::vector &bricks, const ucstring &phraseName); + void setupDisplayAsPhrase(const std::vector &bricks, const std::string &phraseName); // draw a number and returns the width of the drawn number sint32 drawNumber(sint32 x, sint32 y, sint32 wSheet, sint32 hSheet, NLMISC::CRGBA color, sint32 value, bool rightAlign=true); diff --git a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp index 4f173088d..cbc183f35 100644 --- a/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_build_phrase.cpp @@ -296,7 +296,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase) CSBrickManager *pBM= CSBrickManager::getInstance(); - ucstring name; + string name; // if phrase empty (new phrase), invent a new name if(phrase.empty()) @@ -310,7 +310,7 @@ void CDBGroupBuildPhrase::startComposition(const CSPhraseCom &phrase) else { // copy name - name= phrase.Name; + name= phrase.Name.toUtf8(); // get the root Brick. Must exist. CSBrickSheet *rootBrick= pBM->getBrick(phrase.Bricks[0]); diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp index 19083e4ee..e0d4654c8 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_icon_phrase.cpp @@ -136,13 +136,13 @@ void CDBGroupListSheetIconPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin CViewText *name = dynamic_cast(pIG->getView("name")); if (name != NULL) { - ucstring sectionText= CI18N::get("uiPhraseSectionFmt"); + string sectionText= CI18N::get("uiPhraseSectionFmt"); uint32 minLevel, maxLevel; CSPhraseManager *pPM= CSPhraseManager::getInstance(); pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText.toUtf8()); + name->setText (sectionText); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h index b2781eff6..59913998d 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_mission.h @@ -36,7 +36,7 @@ public: // A child node struct CSheetChildMission : public CDBGroupListSheetText::CSheetChild { - virtual void updateText(CDBGroupListSheetText * /* pFather */, ucstring &/* text */) {} + //virtual void updateText(CDBGroupListSheetText * /* pFather */, std::string &/* text */) {} virtual CViewText *createViewText() const; virtual void updateViewText(CDBGroupListSheetText *pFather); virtual bool isInvalidated(CDBGroupListSheetText *pFather); diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp index e8ad3a2e8..842cb4ba7 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_brick_composition.cpp @@ -110,11 +110,11 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::init(CDBGroupListS // *************************************************************************** -bool hasOnlyBlankChars(const ucstring &str) +bool hasOnlyBlankChars(const char *str) { - for(uint i=0;i!=str.size();++i) + for (ptrdiff_t i = 0; str[i]; ++i) { - if(str[i]!=' ') + if (str[i] != ' ') return false; } @@ -128,20 +128,20 @@ void CDBGroupListSheetTextBrickComposition::CSheetChildBrick::updateViewText(CDB CSBrickManager *pBM= CSBrickManager::getInstance(); CDBGroupListSheetTextBrickComposition *compoList= (CDBGroupListSheetTextBrickComposition*)pFather; - ucstring text; + string text; if(Ctrl->getType()!=CCtrlSheetInfo::SheetType_SBrick) return; // Get the compo description of the phrase (Desc2) CSheetId brickSheetId= CSheetId(Ctrl->getSheetId()); // Temp if the Desc2 is empty, set Name - ucstring desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId)); - if( !desc2.empty() && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation - Text->setText(desc2.toUtf8()); + const char *desc2(STRING_MANAGER::CStringManagerClient::getSBrickLocalizedCompositionDescription(brickSheetId)); + if( *desc2 && !hasOnlyBlankChars(desc2)) // tolerate Blank error in translation + Text->setText(desc2); else { desc2 = STRING_MANAGER::CStringManagerClient::getSBrickLocalizedName(brickSheetId); - Text->setText(desc2.toUtf8()); + Text->setText(desc2); } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp index cad06e699..80209c99e 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_text_phrase.cpp @@ -168,13 +168,13 @@ void CDBGroupListSheetTextPhrase::setSectionGroupId(CInterfaceGroup *pIG, uin CViewText *name = dynamic_cast(pIG->getView("name")); if (name != NULL) { - ucstring sectionText= CI18N::get("uiPhraseSectionFmt"); + string sectionText= CI18N::get("uiPhraseSectionFmt"); uint32 minLevel, maxLevel; CSPhraseManager *pPM= CSPhraseManager::getInstance(); pPM->getPhraseLevelFromSection(sectionId, minLevel, maxLevel); strFindReplace(sectionText, "%min", toString(minLevel)); strFindReplace(sectionText, "%max", toString(maxLevel)); - name->setText (sectionText.toUtf8()); + name->setText (sectionText); } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp index f8b5d4b56..a09e69801 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.cpp @@ -432,7 +432,7 @@ void CDBGroupListSheetTrade::CSheetChildTrade::updateViewText(CDBGroupListSheetT // else display the name of the vendor (not if this is the player himself, to avoid flood) else if (LastSellerType == BOTCHATTYPE::Resale) { - text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString.toUtf8(); + text+= "\n" + CI18N::get("uiBotChatVendorTag") + VendorNameString; } } } diff --git a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h index 5d6e121d5..0678ab145 100644 --- a/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h +++ b/ryzom/client/src/interface_v3/dbgroup_list_sheet_trade.h @@ -96,7 +96,7 @@ public: CInterfaceProperty CurrentVendorNameId; CInterfaceProperty CurrentFactionType; CInterfaceProperty CurrentFactionPointPrice; - ucstring VendorNameString; + std::string VendorNameString; virtual void init(CDBGroupListSheetText *pFather, uint index); virtual bool isInvalidated(CDBGroupListSheetText *pFather); diff --git a/ryzom/client/src/interface_v3/group_career.cpp b/ryzom/client/src/interface_v3/group_career.cpp index 10cfca35e..c04d98841 100644 --- a/ryzom/client/src/interface_v3/group_career.cpp +++ b/ryzom/client/src/interface_v3/group_career.cpp @@ -128,7 +128,7 @@ bool CGroupJob::parse (xmlNodePtr /* cur */, CInterfaceGroup * /* parentGroup */ // return false; // } // -// ucstring sTmp = JOBS::jobToUCString(Job); +// string sTmp = JOBS::jobToUCString(Job); // for (uint32 i= 0; i < sTmp.size(); ++i) // if (sTmp[i] < 128) // if ( (sTmp[i] >= 'a') && (sTmp[i] <= 'z') ) diff --git a/ryzom/client/src/interface_v3/group_compas.cpp b/ryzom/client/src/interface_v3/group_compas.cpp index a78c94681..f36e6a637 100644 --- a/ryzom/client/src/interface_v3/group_compas.cpp +++ b/ryzom/client/src/interface_v3/group_compas.cpp @@ -750,8 +750,8 @@ void CGroupCompasMenu::setActive (bool state) /*CEntityCL *entity = EntitiesMngr.entity(UserEntity->selection()); if (entity != NULL) {*/ - //ucstring targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); - std::string targetName = CI18N::get("uiTarget"); + //string targetName = CI18N::get("uiTargetTwoPoint") + entity->removeTitleAndShardFromName(entity->getEntityName()); + string targetName = CI18N::get("uiTarget"); ct.setType(CCompassTarget::Selection); ct.Name = targetName; Targets.push_back(ct); diff --git a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index 9f03834c8..ab9f1c6c7 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -472,11 +472,11 @@ void CGroupInSceneBubbleManager::update () // Send to the around me window // TODO must get the name of the bot etc... /* - ucstring finalString = res; + string finalString = res; for(;;) { - std::string::size_type index = finalString.find (ucstring("{break}")); - if (index == ucstring::npos) break; + std::string::size_type index = finalString.find ("{break}"); + if (index == string::npos) break; finalString = finalString.substr (0, index) + finalString.substr(index+7,finalString.size()); } diff --git a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp index ee2f6c526..276f248a5 100644 --- a/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp +++ b/ryzom/client/src/interface_v3/group_in_scene_user_info.cpp @@ -212,10 +212,10 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) entityTitle.clear(); } - ucstring entityTag1 = entity->getTag(1); - ucstring entityTag2 = entity->getTag(2); - ucstring entityTag3 = entity->getTag(3); - ucstring entityTag4 = entity->getTag(4); + string entityTag1 = entity->getTag(1); + string entityTag2 = entity->getTag(2); + string entityTag3 = entity->getTag(3); + string entityTag4 = entity->getTag(4); string entityPermanentContent = entity->getPermanentStatutIcon(); @@ -471,17 +471,17 @@ CGroupInSceneUserInfo *CGroupInSceneUserInfo::build (CEntityCL *entity) { bitmap = dynamic_cast(leftGroup->getView ("rp_logo_1")); if (bitmap) - bitmap->setTexture(entityTag1.toString()); + bitmap->setTexture(entityTag1); bitmap = dynamic_cast(leftGroup->getView ("rp_logo_2")); if (bitmap) - bitmap->setTexture(entityTag2.toString()); + bitmap->setTexture(entityTag2); } bitmap = dynamic_cast(leftGroup->getView ("rp_logo_3")); if (bitmap) - bitmap->setTexture(entityTag3.toString()); + bitmap->setTexture(entityTag3); bitmap = dynamic_cast(leftGroup->getView ("rp_logo_4")); if (bitmap) - bitmap->setTexture(entityTag4.toString()); + bitmap->setTexture(entityTag4); } // Get the permanent content bitmap @@ -959,14 +959,14 @@ void CGroupInSceneUserInfo::updateDynamicData () { _Name->setColor(entityColor); _Name->setModulateGlobalColor(false); - ucstring entityName = _Entity->getDisplayName(); + string entityName = _Entity->getDisplayName(); if (entityName.empty()) entityName = _Entity->getTitle(); if (pPlayer != NULL) if (pPlayer->isAFK()) entityName += CI18N::get("uiAFK"); - _Name->setText(entityName.toUtf8()); + _Name->setText(entityName); // Title color get the PVP color if (_Title) diff --git a/ryzom/client/src/interface_v3/group_map.cpp b/ryzom/client/src/interface_v3/group_map.cpp index 8582b938e..45bcf79c2 100644 --- a/ryzom/client/src/interface_v3/group_map.cpp +++ b/ryzom/client/src/interface_v3/group_map.cpp @@ -146,7 +146,7 @@ static void popupLandMarkNameDialog() else { NLGUI::CDBManager::getInstance()->getDbProp( "UI:TEMP:LANDMARKTYPE" )->setValue8(cb->getTextPos(CUserLandMark::Misc)); - eb->setInputStringAsUtf16(ucstring()); + eb->setInputString(string()); } CWidgetManager::getInstance()->setCaptureKeyboard(eb); diff --git a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp index 7d2054fc4..48d3bd8d4 100644 --- a/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp +++ b/ryzom/client/src/interface_v3/group_phrase_skill_filter.cpp @@ -191,9 +191,9 @@ void CGroupPhraseSkillFilter::rebuild() uint nCounter = 0; // local variable (avoid realloc in loop) - vector< pair > tempVec(2); - ucstring sSkillName; - string sDBNameSkillValue; + // vector< pair > tempVec(2); + // string sSkillName; + // string sDBNameSkillValue; // Build the hierarchy while ((!bQuit) && (nCounter < 32)) // Counter is used to not infinitly loop diff --git a/ryzom/client/src/interface_v3/guild_manager.cpp b/ryzom/client/src/interface_v3/guild_manager.cpp index 39fe7e05e..6d8a0f864 100644 --- a/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/ryzom/client/src/interface_v3/guild_manager.cpp @@ -1266,7 +1266,7 @@ class CHandlerInvGuildToBag : public IActionHandler if (!bPlaceFound) { - ucstring msg = CI18N::get("msgCantPutItemInBag"); + string msg = CI18N::get("msgCantPutItemInBag"); string cat = getStringCategory(msg, msg); pIM->displaySystemInfo(msg, cat); return; diff --git a/ryzom/client/src/interface_v3/interface_ddx.cpp b/ryzom/client/src/interface_v3/interface_ddx.cpp index 36bd17e62..230b7a2c2 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.cpp +++ b/ryzom/client/src/interface_v3/interface_ddx.cpp @@ -351,7 +351,7 @@ void CInterfaceDDX::CParam::updateScrollView(sint32 nVal) { if(ResultView) { - ResultView->setText(toString(nVal) + ResultUnit.toUtf8()); + ResultView->setText(toString(nVal) + ResultUnit); } } @@ -362,7 +362,7 @@ void CInterfaceDDX::CParam::updateScrollView(double nVal) { // allow N digits string fmt= toString("%%.%df", ResultDecimal); - ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit.toUtf8()); + ResultView->setText(toString(fmt.c_str(), nVal) + ResultUnit); } } diff --git a/ryzom/client/src/interface_v3/interface_ddx.h b/ryzom/client/src/interface_v3/interface_ddx.h index 48f329053..2be1c84b4 100644 --- a/ryzom/client/src/interface_v3/interface_ddx.h +++ b/ryzom/client/src/interface_v3/interface_ddx.h @@ -79,7 +79,7 @@ private: // The tex view, result of the scroll CViewTextPtr ResultView; // The unit to append to the result string - ucstring ResultUnit; + std::string ResultUnit; // For ScrollBarFloat widget only uint8 ResultDecimal; // For ScrollBarFloat widget only diff --git a/ryzom/client/src/interface_v3/interface_manager.cpp b/ryzom/client/src/interface_v3/interface_manager.cpp index aa38b6dbf..3329a2aae 100644 --- a/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1527,7 +1527,7 @@ void CInterfaceManager::updateFrameEvents() if ((T0 - _UpdateWeatherTime) > (1 * 3 * 1000)) { _UpdateWeatherTime = T0; - ucstring str = CI18N::get ("uiTheSeasonIs") + + string str = CI18N::get ("uiTheSeasonIs") + CI18N::get ("uiSeason"+toStringEnum(computeCurrSeason())) + CI18N::get ("uiAndTheWeatherIs") + CI18N::get (WeatherManager.getCurrWeatherState().LocalizedName) + @@ -1537,7 +1537,7 @@ void CInterfaceManager::updateFrameEvents() CViewText *pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather")); if (pVT != NULL) - pVT->setText(str.toUtf8()); + pVT->setText(str); CCtrlBase *pTooltip= dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:weather_tt")); if (pTooltip != NULL) @@ -1571,7 +1571,7 @@ void CInterfaceManager::updateFrameEvents() pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time")); if (pVT != NULL) - pVT->setText(str.toUtf8()); + pVT->setText(str); str.clear(); // Update the clock in the compass if enabled. @@ -1584,7 +1584,7 @@ void CInterfaceManager::updateFrameEvents() str = getTimestampHuman("%I:%M %p"); else str = getTimestampHuman("%H:%M"); - pVT->setText(str.toUtf8()); + pVT->setText(str); } } } @@ -2389,7 +2389,7 @@ void CInterfaceManager::processServerIDString() } // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucstring &text, const string &masterGroup, TCaseMode caseMode) +void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const string &text, const string &masterGroup, TCaseMode caseMode) { CInterfaceGroup *group= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup)); CViewText *viewText= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":" + msgBoxGroup + ":text")); @@ -2397,7 +2397,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst if (group && viewText) { viewText->setCaseMode(caseMode); - viewText->setText(text.toUtf8()); + viewText->setText(text); CWidgetManager::getInstance()->enableModalWindow(NULL, group); // don't understand why but need to update coords here group->updateCoords(); @@ -2406,7 +2406,7 @@ void CInterfaceManager::messageBoxInternal(const string &msgBoxGroup, const ucst } // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::messageBox(const ucstring &text, const string &masterGroup, TCaseMode caseMode) +void CInterfaceManager::messageBox(const string &text, const string &masterGroup, TCaseMode caseMode) { messageBoxInternal("message_box", text, masterGroup, caseMode); } @@ -2435,7 +2435,7 @@ void CInterfaceManager::messageBoxWithHelp(const std::string &text, const std::s // ------------------------------------------------------------------------------------------------ -void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk, +void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string ¶msOnOk, const std::string &ahOnCancel, const std::string ¶msOnCancel, const string &masterGroup) { CInterfaceGroup *group= dynamic_cast(CWidgetManager::getInstance()->getElementFromId(masterGroup+":valid_message_box")); @@ -2450,7 +2450,7 @@ void CInterfaceManager::validMessageBox(TValidMessageIcon icon, const ucstring & CWidgetManager::getInstance()->setProcedureAction("proc_valid_message_box_cancel", 1, ahOnCancel, paramsOnCancel); // set text and icon - viewText->setText(text.toUtf8()); + viewText->setText(text); if(viewBitmap) { bool active= true; @@ -2978,7 +2978,7 @@ bool CInterfaceManager::deletePlayerKeys (const std::string &playerFileIdent) } // *************************************************************************** -void CInterfaceManager::log(const ucstring &str, const std::string &cat) +void CInterfaceManager::log(const std::string &str, const std::string &cat) { if (_LogState) { @@ -2987,7 +2987,7 @@ void CInterfaceManager::log(const ucstring &str, const std::string &cat) FILE *f = nlfopen(fileName, "at"); if (f != NULL) { - const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str.toUtf8(); + const string finalString = string(NLMISC::IDisplayer::dateToHumanString()) + " (" + NLMISC::toUpper(cat) + ") * " + str; fprintf(f, "%s\n", finalString.c_str()); fclose(f); } @@ -3176,8 +3176,8 @@ struct CEmoteEntry string::size_type pos1 = path1.find('|'); string::size_type pos2 = path2.find('|'); - ucstring s1 = toUpper(CI18N::get(path1.substr(0, pos1))); - ucstring s2 = toUpper(CI18N::get(path2.substr(0, pos2))); + string s1 = toUpper(CI18N::get(path1.substr(0, pos1))); + string s2 = toUpper(CI18N::get(path2.substr(0, pos2))); sint result = s1.compare(s2); if (result != 0) @@ -3195,14 +3195,14 @@ struct CEmoteEntry } }; -static bool translateEmote(const std::string &id, ucstring &translatedName, std::string &commandName, std::string &commandNameAlt) +static bool translateEmote(const std::string &id, std::string &translatedName, std::string &commandName, std::string &commandNameAlt) { if (CI18N::hasTranslation(id)) { translatedName = CI18N::get(id); // convert command to utf8 since emote translation can have strange chars - commandName = toLower(translatedName).toUtf8(); + commandName = toLower(translatedName); // replace all spaces by _ while (strFindReplace(commandName, " ", "_")); @@ -3301,7 +3301,7 @@ void CInterfaceManager::initEmotes() CGroupSubMenu *pMenu = pRootMenu->getRootMenu(); nlassert(pMenu); - ucstring sTranslatedName; + std::string sTranslatedName; std::string sCommandName; std::string sCommandNameAlt; @@ -3345,7 +3345,7 @@ void CInterfaceManager::initEmotes() translateEmote(sTmp, sTranslatedName, sCommandName, sCommandNameAlt); // Create a line - pMenu->addLine (sTranslatedName.toUtf8() + " (/" + sCommandName + ")", "emote", + pMenu->addLine (sTranslatedName + " (/" + sCommandName + ")", "emote", "nb="+toString(nEmoteNb)+"|behav="+toString(nBehav), sTmp); } } diff --git a/ryzom/client/src/interface_v3/interface_manager.h b/ryzom/client/src/interface_v3/interface_manager.h index 91178677d..5206e0513 100644 --- a/ryzom/client/src/interface_v3/interface_manager.h +++ b/ryzom/client/src/interface_v3/interface_manager.h @@ -241,7 +241,7 @@ public: // Log system (all chat/tell void setLogState(bool state) { _LogState = state; } bool getLogState() const { return _LogState; } - void log(const ucstring &str, const std::string &cat = ""); + void log(const std::string &str, const std::string &cat = ""); /// Text from here and from server @@ -305,7 +305,7 @@ public: /** Open a MessageBox. this is a simple ModalWindow with a Ok button * ui:interface:message_box must be defined in xml, with a "text" ViewText son */ - void messageBox(const ucstring &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp); + void messageBox(const std::string &text, const std::string &masterGroup="ui:interface", TCaseMode caseMode = CaseFirstSentenceLetterUp); /** Open a MessageBox. this is a simple ModalWindow with a Ok and a HELP button. * The help button with open a browser on ryzom.com faq * ui:interface:message_box_with_help must be defined in xml, with a "text" ViewText son @@ -321,7 +321,7 @@ public: * \param ahOnCancel => the action handler to call if cancel is pressed. NB: you don't have to call leave_modal in this ah (auto done). * \param paramsOnCancel => params passed to ahOnCancel. */ - void validMessageBox(TValidMessageIcon icon, const ucstring &text, const std::string &ahOnOk, const std::string ¶msOnOk= std::string(), + void validMessageBox(TValidMessageIcon icon, const std::string &text, const std::string &ahOnOk, const std::string ¶msOnOk= std::string(), const std::string &ahOnCancel= std::string(), const std::string ¶msOnCancel= std::string(), const std::string &masterGroup="ui:interface"); /** Get the current running validMessageBox OnOk action. empty if no validMessageBox currently opened @@ -446,7 +446,7 @@ public: */ static char* getTimestampHuman(const char* format = "[%H:%M:%S] "); - /** Parses any tokens in the ucstring like $t$ or $g()$ + /** Parses any tokens in the utf-8 string like $t$ or $g()$ */ static bool parseTokens(std::string& ucstr); @@ -672,7 +672,7 @@ private: CServerToLocalAutoCopy ServerToLocalAutoCopyDMGift; // Pop a new message box. If the message box was found, returns a pointer on it - void messageBoxInternal(const std::string &msgBoxGroup, const ucstring &text, const std::string &masterGroup, TCaseMode caseMode); + void messageBoxInternal(const std::string &msgBoxGroup, const std::string &text, const std::string &masterGroup, TCaseMode caseMode); CInterfaceLink::CInterfaceLinkUpdater *interfaceLinkUpdater; }; diff --git a/ryzom/client/src/interface_v3/item_special_effect.cpp b/ryzom/client/src/interface_v3/item_special_effect.cpp index fdb53a0ec..84dbdf785 100644 --- a/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -66,7 +66,7 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) { string tmp = "%"; tmp += s[0]; - if (s.size() >=2 && isdigit(s[1])) + if (s.size() >=2 && (uint8)s[1] < (uint8)'\x80' && isdigit(s[1])) tmp += s[1]; params.push_back(tmp); } diff --git a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 0e97c73f7..bd2377bcb 100644 --- a/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -825,7 +825,7 @@ int CLuaIHMRyzom::validMessageBox(CLuaState &ls) CLuaIHM::checkArgType(ls, funcName, 5, LUA_TSTRING); CLuaIHM::checkArgType(ls, funcName, 6, LUA_TSTRING); CInterfaceManager *im = CInterfaceManager::getInstance(); - im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg, ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6)); + im->validMessageBox(CInterfaceManager::QuestionIconMsg, msg.toUtf8(), ls.toString(2), ls.toString(3), ls.toString(4), ls.toString(5), ls.toString(6)); return 0; } @@ -2889,7 +2889,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text) { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text); + pIM->messageBox(text.toUtf8()); } // *************************************************************************** @@ -2897,7 +2897,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr { //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text, masterGroup); + pIM->messageBox(text.toUtf8(), masterGroup); } // *************************************************************************** @@ -2910,7 +2910,7 @@ void CLuaIHMRyzom::messageBox(const ucstring &text, const std::string &masterGr //H_AUTO(Lua_CLuaIHM_messageBox) CInterfaceManager *pIM = CInterfaceManager::getInstance(); - pIM->messageBox(text, masterGroup, (TCaseMode) caseMode); + pIM->messageBox(text.toUtf8(), masterGroup, (TCaseMode) caseMode); } // *************************************************************************** @@ -3652,7 +3652,7 @@ void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) CInterfaceManager *im = CInterfaceManager::getInstance(); w->setKeyboardFocus(); w->enableBlink(1); - w->setCommand(ucstring("tell ") + CEntityCL::removeTitleFromName(player.toUtf8()) + ucstring(" "), false); + w->setCommand("tell " + CEntityCL::removeTitleFromName(player.toUtf8()) + " ", false); CGroupEditBox *eb = w->getEditBox(); if (eb != NULL) diff --git a/ryzom/client/src/interface_v3/people_interraction.cpp b/ryzom/client/src/interface_v3/people_interraction.cpp index 98432cdb8..d1c43d897 100644 --- a/ryzom/client/src/interface_v3/people_interraction.cpp +++ b/ryzom/client/src/interface_v3/people_interraction.cpp @@ -3201,7 +3201,7 @@ NLMISC_COMMAND(party_chat, "Create a new party chat", "") return true; } CPeopleInterraction &pi = PeopleInterraction; - ucstring title = args[0]; + string title = args[0]; if (!pi.testValidPartyChatName(title)) { @@ -3221,16 +3221,16 @@ NLMISC_COMMAND(remove_party_chat, "Remove a party chat", "") displayVisibleSystemMsg(CI18N::get("uiRemovePartyChatCmd")); return true; } - ucstring title = ucstring(args[0]); + string title = ucstring(args[0]); CChatWindow *chat = getChatWndMgr().getChatWindow(title); if (!chat) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiBadPartyChatName")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiBadPartyChatName")); return true; } if (!PeopleInterraction.removePartyChat(chat)) { - displayVisibleSystemMsg(title + ucstring(" : ") + CI18N::get("uiCantRemovePartyChat")); + displayVisibleSystemMsg(title + " : " + CI18N::get("uiCantRemovePartyChat")); return true; } return true; diff --git a/ryzom/client/src/interface_v3/sbrick_manager.cpp b/ryzom/client/src/interface_v3/sbrick_manager.cpp index a2cecf2d4..780b1301c 100644 --- a/ryzom/client/src/interface_v3/sbrick_manager.cpp +++ b/ryzom/client/src/interface_v3/sbrick_manager.cpp @@ -486,7 +486,7 @@ void CSBrickManager::compileBrickProperties() k++; } // Param Id modifier? (ie read not the 0th value, but the 1th etc... up to 9) - else if(k 0) { int currChar = (int) baseName[lastIndex]; - if (!isdigit(currChar) && + if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) && currChar != ' ' && currChar != '\t') { @@ -4289,7 +4289,7 @@ ucstring CEditor::genInstanceName(const ucstring &baseName) while (lastIndex > 0) { int currChar = (int) strippedName[lastIndex]; - if (!isdigit(currChar) && + if (((uint8)currChar >= (uint8)'\x80' || !isdigit(currChar)) && currChar != ' ' && currChar != '\t') { diff --git a/ryzom/client/src/zone_util.cpp b/ryzom/client/src/zone_util.cpp index d7da6810c..0f2a84636 100644 --- a/ryzom/client/src/zone_util.cpp +++ b/ryzom/client/src/zone_util.cpp @@ -44,7 +44,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) uint32 i = 0; while (zoneName[i] != '_') { - if (!::isdigit(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isdigit(zoneName[i])) return false; yStr += zoneName[i]; ++i; if (i == zoneName.size()) return false; @@ -52,7 +52,7 @@ bool getPosFromZoneName(const std::string &name,NLMISC::CVector2f &dest) ++i; while (i < zoneName.size()) { - if (!::isalpha(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isalpha(zoneName[i])) return false; xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; @@ -80,7 +80,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) uint32 i = 0; while (zoneName[i] != '_') { - if (!::isdigit(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isdigit(zoneName[i])) return false; yStr += zoneName[i]; ++i; if (i == zoneName.size()) return false; @@ -88,7 +88,7 @@ bool getZonePosFromZoneName(const std::string &name, sint &x, sint &y) ++i; while (i < zoneName.size()) { - if (!::isalpha(zoneName[i])) return false; + if ((uint8)zoneName[i] >= (uint8)'\x80' || !::isalpha(zoneName[i])) return false; xStr += (char) NLMISC::toUpper(zoneName[i]); ++i; } if (xStr.size() != 2) return false; diff --git a/ryzom/common/src/game_share/character_title.h b/ryzom/common/src/game_share/character_title.h index 5ad8c3c10..bae0c2a4b 100644 --- a/ryzom/common/src/game_share/character_title.h +++ b/ryzom/common/src/game_share/character_title.h @@ -301,9 +301,9 @@ inline ECharacterTitle getGMTitleFromPriv (const std::string& priv) //---------------------------------------------------------------------- -inline bool isCsrTitle(const ucstring& title) +inline bool isCsrTitle(const std::string& title) { - ECharacterTitle titleEnum = toCharacterTitle( title.toUtf8() ); + ECharacterTitle titleEnum = toCharacterTitle( title ); bool bIsCsrTitle = (titleEnum >= SGM && titleEnum <= CM); return bIsCsrTitle; diff --git a/ryzom/common/src/game_share/utils.h b/ryzom/common/src/game_share/utils.h index cb22574a4..eb527162f 100644 --- a/ryzom/common/src/game_share/utils.h +++ b/ryzom/common/src/game_share/utils.h @@ -44,7 +44,11 @@ inline std::string capitalize(const std::string & s) if ( s.empty() ) return s; - return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + std::string res; + res.reserve(4); + ptrdiff_t i = 0; + NLMISC::appendToUpper(res, s, i); + return res + NLMISC::toLower(s.substr(i)); } inline ucstring capitalize(const ucstring & s) @@ -52,7 +56,8 @@ inline ucstring capitalize(const ucstring & s) if ( s.empty() ) return s; - return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + // return NLMISC::toUpper( s.substr(0,1) ) + NLMISC::toLower( s.substr(1,std::string::npos) ); + return ucstring::makeFromUtf8(capitalize(s.toUtf8())); }