@@ -85,7 +85,7 @@ struct TextDestNodeMetadata : public TextDest {
85
85
// This is deprecated I guess? -celeron55
86
86
void gotText (std::wstring text)
87
87
{
88
- std::string ntext = wide_to_narrow (text);
88
+ std::string ntext = wide_to_utf8 (text);
89
89
infostream << " Submitting 'text' field of node at (" << m_p.X << " ,"
90
90
<< m_p.Y << " ," << m_p.Z << " ): " << ntext << std::endl;
91
91
StringMap fields;
@@ -183,7 +183,7 @@ struct LocalFormspecHandler : public TextDest {
183
183
(fields.find (" quit" ) != fields.end ())) {
184
184
StringMap::const_iterator it = fields.find (" f_text" );
185
185
if (it != fields.end ())
186
- m_client->typeChatMessage (narrow_to_wide (it->second ));
186
+ m_client->typeChatMessage (utf8_to_wide (it->second ));
187
187
188
188
return ;
189
189
}
@@ -445,7 +445,7 @@ void update_profiler_gui(gui::IGUIStaticText *guitext_profiler, FontEngine *fe,
445
445
446
446
std::ostringstream os (std::ios_base::binary);
447
447
g_profiler->printPage (os, show_profiler, show_profiler_max);
448
- std::wstring text = narrow_to_wide (os.str ());
448
+ std::wstring text = utf8_to_wide (os.str ());
449
449
guitext_profiler->setText (text.c_str ());
450
450
guitext_profiler->setVisible (true );
451
451
@@ -582,16 +582,16 @@ class ProfilerGraph
582
582
s32 texth = 15 ;
583
583
char buf[10 ];
584
584
snprintf (buf, 10 , " %.3g" , show_max);
585
- font->draw (narrow_to_wide (buf).c_str (),
585
+ font->draw (utf8_to_wide (buf).c_str (),
586
586
core::rect<s32>(textx, y - graphh,
587
587
textx2, y - graphh + texth),
588
588
meta.color );
589
589
snprintf (buf, 10 , " %.3g" , show_min);
590
- font->draw (narrow_to_wide (buf).c_str (),
590
+ font->draw (utf8_to_wide (buf).c_str (),
591
591
core::rect<s32>(textx, y - texth,
592
592
textx2, y),
593
593
meta.color );
594
- font->draw (narrow_to_wide (id).c_str (),
594
+ font->draw (utf8_to_wide (id).c_str (),
595
595
core::rect<s32>(textx, y - graphh / 2 - texth / 2 ,
596
596
textx2, y - graphh / 2 + texth / 2 ),
597
597
meta.color );
@@ -1049,7 +1049,7 @@ static void show_chat_menu(GUIFormSpecMenu **cur_formspec,
1049
1049
FORMSPEC_VERSION_STRING
1050
1050
SIZE_TAG
1051
1051
" field[3,2.35;6,0.5;f_text;;" + text + " ]"
1052
- " button_exit[4,3;3,0.5;btn_send;" + wide_to_narrow (wstrgettext (" Proceed" )) + " ]"
1052
+ " button_exit[4,3;3,0.5;btn_send;" + wide_to_utf8 (wstrgettext (" Proceed" )) + " ]"
1053
1053
;
1054
1054
1055
1055
/* Create menu */
@@ -1089,7 +1089,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
1089
1089
bool singleplayermode)
1090
1090
{
1091
1091
#ifdef __ANDROID__
1092
- std::string control_text = wide_to_narrow (wstrgettext (" Default Controls:\n "
1092
+ std::string control_text = wide_to_utf8 (wstrgettext (" Default Controls:\n "
1093
1093
" No menu visible:\n "
1094
1094
" - single tap: button activate\n "
1095
1095
" - double tap: place/use\n "
@@ -1103,7 +1103,7 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
1103
1103
" --> place single item to slot\n "
1104
1104
));
1105
1105
#else
1106
- std::string control_text = wide_to_narrow (wstrgettext (" Default Controls:\n "
1106
+ std::string control_text = wide_to_utf8 (wstrgettext (" Default Controls:\n "
1107
1107
" - WASD: move\n "
1108
1108
" - Space: jump/climb\n "
1109
1109
" - Shift: sneak/go down\n "
@@ -1122,23 +1122,23 @@ static void show_pause_menu(GUIFormSpecMenu **cur_formspec,
1122
1122
1123
1123
os << FORMSPEC_VERSION_STRING << SIZE_TAG
1124
1124
<< " button_exit[4," << (ypos++) << " ;3,0.5;btn_continue;"
1125
- << wide_to_narrow (wstrgettext (" Continue" )) << " ]" ;
1125
+ << wide_to_utf8 (wstrgettext (" Continue" )) << " ]" ;
1126
1126
1127
1127
if (!singleplayermode) {
1128
1128
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_change_password;"
1129
- << wide_to_narrow (wstrgettext (" Change Password" )) << " ]" ;
1129
+ << wide_to_utf8 (wstrgettext (" Change Password" )) << " ]" ;
1130
1130
}
1131
1131
1132
1132
#ifndef __ANDROID__
1133
1133
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_sound;"
1134
- << wide_to_narrow (wstrgettext (" Sound Volume" )) << " ]" ;
1134
+ << wide_to_utf8 (wstrgettext (" Sound Volume" )) << " ]" ;
1135
1135
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_key_config;"
1136
- << wide_to_narrow (wstrgettext (" Change Keys" )) << " ]" ;
1136
+ << wide_to_utf8 (wstrgettext (" Change Keys" )) << " ]" ;
1137
1137
#endif
1138
1138
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_exit_menu;"
1139
- << wide_to_narrow (wstrgettext (" Exit to Menu" )) << " ]" ;
1139
+ << wide_to_utf8 (wstrgettext (" Exit to Menu" )) << " ]" ;
1140
1140
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_exit_os;"
1141
- << wide_to_narrow (wstrgettext (" Exit to OS" )) << " ]"
1141
+ << wide_to_utf8 (wstrgettext (" Exit to OS" )) << " ]"
1142
1142
<< " textarea[7.5,0.25;3.9,6.25;;" << control_text << " ;]"
1143
1143
<< " textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME_C " \n "
1144
1144
<< g_build_info << " \n "
@@ -1167,7 +1167,7 @@ static void updateChat(Client &client, f32 dtime, bool show_debug,
1167
1167
1168
1168
// Get new messages from error log buffer
1169
1169
while (!chat_log_error_buf.empty ()) {
1170
- chat_backend.addMessage (L" " , narrow_to_wide (chat_log_error_buf.get ()));
1170
+ chat_backend.addMessage (L" " , utf8_to_wide (chat_log_error_buf.get ()));
1171
1171
}
1172
1172
1173
1173
// Get new messages from client
@@ -2059,7 +2059,7 @@ bool Game::createClient(const std::string &playername,
2059
2059
2060
2060
/* Set window caption
2061
2061
*/
2062
- std::wstring str = narrow_to_wide (PROJECT_NAME_C);
2062
+ std::wstring str = utf8_to_wide (PROJECT_NAME_C);
2063
2063
str += L" [" ;
2064
2064
str += driver->getName ();
2065
2065
str += L" ]" ;
@@ -2087,7 +2087,7 @@ bool Game::initGui()
2087
2087
{
2088
2088
// First line of debug text
2089
2089
guitext = guienv->addStaticText (
2090
- narrow_to_wide (PROJECT_NAME_C).c_str (),
2090
+ utf8_to_wide (PROJECT_NAME_C).c_str (),
2091
2091
core::rect<s32>(0 , 0 , 0 , 0 ),
2092
2092
false , false , guiroot);
2093
2093
@@ -2342,7 +2342,7 @@ bool Game::getServerContent(bool *aborted)
2342
2342
}
2343
2343
2344
2344
progress = 30 + client->mediaReceiveProgress () * 35 + 0.5 ;
2345
- draw_load_screen (narrow_to_wide (message.str ()), device,
2345
+ draw_load_screen (utf8_to_wide (message.str ()), device,
2346
2346
guienv, dtime, progress);
2347
2347
}
2348
2348
}
@@ -2660,7 +2660,7 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
2660
2660
2661
2661
if (quicktune->hasMessage ()) {
2662
2662
std::string msg = quicktune->getMessage ();
2663
- statustext = narrow_to_wide (msg);
2663
+ statustext = utf8_to_wide (msg);
2664
2664
*statustext_time = 0 ;
2665
2665
}
2666
2666
}
@@ -2947,7 +2947,7 @@ void Game::increaseViewRange(float *statustext_time)
2947
2947
s16 range = g_settings->getS16 (" viewing_range_nodes_min" );
2948
2948
s16 range_new = range + 10 ;
2949
2949
g_settings->set (" viewing_range_nodes_min" , itos (range_new));
2950
- statustext = narrow_to_wide (" Minimum viewing range changed to "
2950
+ statustext = utf8_to_wide (" Minimum viewing range changed to "
2951
2951
+ itos (range_new));
2952
2952
*statustext_time = 0 ;
2953
2953
}
@@ -2962,7 +2962,7 @@ void Game::decreaseViewRange(float *statustext_time)
2962
2962
range_new = range;
2963
2963
2964
2964
g_settings->set (" viewing_range_nodes_min" , itos (range_new));
2965
- statustext = narrow_to_wide (" Minimum viewing range changed to "
2965
+ statustext = utf8_to_wide (" Minimum viewing range changed to "
2966
2966
+ itos (range_new));
2967
2967
*statustext_time = 0 ;
2968
2968
}
@@ -3577,13 +3577,13 @@ void Game::handlePointingAtNode(GameRunData *runData,
3577
3577
NodeMetadata *meta = map.getNodeMetadata (nodepos);
3578
3578
3579
3579
if (meta) {
3580
- infotext = narrow_to_wide (meta->getString (" infotext" ));
3580
+ infotext = utf8_to_wide (meta->getString (" infotext" ));
3581
3581
} else {
3582
3582
MapNode n = map.getNodeNoEx (nodepos);
3583
3583
3584
3584
if (nodedef_manager->get (n).tiledef [0 ].name == " unknown_node.png" ) {
3585
3585
infotext = L" Unknown node: " ;
3586
- infotext += narrow_to_wide (nodedef_manager->get (n).name );
3586
+ infotext += utf8_to_wide (nodedef_manager->get (n).name );
3587
3587
}
3588
3588
}
3589
3589
@@ -3649,10 +3649,10 @@ void Game::handlePointingAtObject(GameRunData *runData,
3649
3649
const v3f &player_position,
3650
3650
bool show_debug)
3651
3651
{
3652
- infotext = narrow_to_wide (runData->selected_object ->infoText ());
3652
+ infotext = utf8_to_wide (runData->selected_object ->infoText ());
3653
3653
3654
3654
if (infotext == L" " && show_debug) {
3655
- infotext = narrow_to_wide (runData->selected_object ->debugInfoText ());
3655
+ infotext = utf8_to_wide (runData->selected_object ->debugInfoText ());
3656
3656
}
3657
3657
3658
3658
if (input->getLeftState ()) {
@@ -4117,12 +4117,12 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
4117
4117
<< " , v_range = " << draw_control->wanted_range
4118
4118
<< std::setprecision (3 )
4119
4119
<< " , RTT = " << client->getRTT ();
4120
- guitext->setText (narrow_to_wide (os.str ()).c_str ());
4120
+ guitext->setText (utf8_to_wide (os.str ()).c_str ());
4121
4121
guitext->setVisible (true );
4122
4122
} else if (flags.show_hud || flags.show_chat ) {
4123
4123
std::ostringstream os (std::ios_base::binary);
4124
4124
os << PROJECT_NAME_C " " << g_version_hash;
4125
- guitext->setText (narrow_to_wide (os.str ()).c_str ());
4125
+ guitext->setText (utf8_to_wide (os.str ()).c_str ());
4126
4126
guitext->setVisible (true );
4127
4127
} else {
4128
4128
guitext->setVisible (false );
@@ -4159,7 +4159,7 @@ void Game::updateGui(float *statustext_time, const RunStats &stats,
4159
4159
}
4160
4160
}
4161
4161
4162
- guitext2->setText (narrow_to_wide (os.str ()).c_str ());
4162
+ guitext2->setText (utf8_to_wide (os.str ()).c_str ());
4163
4163
guitext2->setVisible (true );
4164
4164
4165
4165
core::rect<s32> rect (
0 commit comments