From b0784ba87168e24b0533fc8718a0157cda5ea405 Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 7 Jul 2015 05:55:07 +0200 Subject: 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. --- src/network/serverpackethandler.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/network/serverpackethandler.cpp') 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; } } -- cgit v1.2.3