diff options
author | est31 <MTest31@outlook.com> | 2015-07-07 05:55:07 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-07-08 10:12:44 +0200 |
commit | b0784ba87168e24b0533fc8718a0157cda5ea405 (patch) | |
tree | 24ca04bbfe2a13193400493e1bde5e520c589e03 /src/network | |
parent | e234d8b3786d5adfbdf3d1a2123c3e8d91c21880 (diff) | |
download | minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.tar.gz minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.tar.bz2 minetest-b0784ba87168e24b0533fc8718a0157cda5ea405.zip |
Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientpackethandler.cpp | 2 | ||||
-rw-r--r-- | src/network/serverpackethandler.cpp | 22 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 1ec6a2a1a..4cebb2184 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -228,7 +228,7 @@ void Client::handleCommand_AccessDenied(NetworkPacket* pkt) if (pkt->getSize() >= 2) { std::wstring wide_reason; *pkt >> wide_reason; - m_access_denied_reason = wide_to_narrow(wide_reason); + m_access_denied_reason = wide_to_utf8(wide_reason); } } } diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 0a6ef4fa8..92dfe1020 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -356,7 +356,7 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) DenyAccess_Legacy(pkt->getPeerId(), std::wstring( L"Your client's version is not supported.\n" L"Server version is ") - + narrow_to_wide(g_version_string) + L"." + + utf8_to_wide(g_version_string) + L"." ); return; } @@ -408,15 +408,15 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) DenyAccess_Legacy(pkt->getPeerId(), std::wstring( L"Your client's version is not supported.\n" L"Server version is ") - + narrow_to_wide(g_version_string) + L",\n" + + utf8_to_wide(g_version_string) + L",\n" + L"server's PROTOCOL_VERSION is " - + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN)) + + utf8_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN)) + L"..." - + narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MAX)) + + utf8_to_wide(itos(SERVER_PROTOCOL_VERSION_MAX)) + L", client's PROTOCOL_VERSION is " - + narrow_to_wide(itos(min_net_proto_version)) + + utf8_to_wide(itos(min_net_proto_version)) + L"..." - + narrow_to_wide(itos(max_net_proto_version)) + + utf8_to_wide(itos(max_net_proto_version)) ); return; } @@ -428,13 +428,13 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) DenyAccess_Legacy(pkt->getPeerId(), std::wstring( L"Your client's version is not supported.\n" L"Server version is ") - + narrow_to_wide(g_version_string) + L",\n" + + utf8_to_wide(g_version_string) + L",\n" + L"server's PROTOCOL_VERSION (strict) is " - + narrow_to_wide(itos(LATEST_PROTOCOL_VERSION)) + + utf8_to_wide(itos(LATEST_PROTOCOL_VERSION)) + L", client's PROTOCOL_VERSION is " - + narrow_to_wide(itos(min_net_proto_version)) + + utf8_to_wide(itos(min_net_proto_version)) + L"..." - + narrow_to_wide(itos(max_net_proto_version)) + + utf8_to_wide(itos(max_net_proto_version)) ); return; } @@ -487,7 +487,7 @@ void Server::handleCommand_Init_Legacy(NetworkPacket* pkt) << "tried to connect from " << addr_s << " " << "but it was disallowed for the following reason: " << reason << std::endl; - DenyAccess_Legacy(pkt->getPeerId(), narrow_to_wide(reason.c_str())); + DenyAccess_Legacy(pkt->getPeerId(), utf8_to_wide(reason.c_str())); return; } } |