Add support for character encodings

Previous commit added support of it to Csocket.
When encoding is specified, core will convert incoming messages to UTF-8,
and outgoing messages from UTF-8.
When no encoding is specified, it will do nothing to bytes, like before.
This is to be changed somewhere in future, to have UTF-8 on wire by
default too.
When encoding's name starts with *, incoming messages will be treated as
UTF-8, if it is already correct UTF-8. Otherwise, it's converted.

Fix #151
Fix #366
This commit is contained in:
Alexey Sokolov
2013-11-14 08:25:58 +04:00
parent 6012cdee77
commit c0a5ecb40b
9 changed files with 43 additions and 0 deletions

View File

@@ -673,6 +673,7 @@ void CClient::AcceptLogin(CUser& User) {
SetTimeout(540, TMO_READ);
SetSockName("USR::" + m_pUser->GetUserName());
SetEncoding(m_pUser->GetClientEncoding());
if (!m_sNetwork.empty()) {
m_pNetwork = m_pUser->FindNetwork(m_sNetwork);