From ad0c3324546dd9394dcd5e42d99d41ea2abba83c Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sat, 9 Jan 2016 20:26:22 +0000 Subject: [PATCH] Add test for encoding change --- test/Integration.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/Integration.cpp b/test/Integration.cpp index ca6eefd7..6c0f132f 100644 --- a/test/Integration.cpp +++ b/test/Integration.cpp @@ -1773,4 +1773,34 @@ TEST_F(ZNCTest, Modpython) { Z; } +TEST_F(ZNCTest, Encoding) { + auto znc = Run(); + Z; + auto ircd = ConnectIRCd(); + Z; + auto client = LoginClient(); + Z; + ircd.Write(":server 001 nick :hello"); + // legacy + ircd.Write(":n!u@h PRIVMSG nick :Hello\xE6world"); + client.ReadUntil("Hello\xE6world"); + Z; + client.Write("PRIVMSG *controlpanel :SetNetwork Encoding $me $net UTF-8"); + client.ReadUntil("Encoding = UTF-8"); + Z; + ircd.Write(":n!u@h PRIVMSG nick :Hello\xE6world"); + client.ReadUntil("Hello\xEF\xBF\xBDworld"); + Z; + client.Write( + "PRIVMSG *controlpanel :SetNetwork Encoding $me $net ^CP-1251"); + client.ReadUntil("Encoding = ^CP-1251"); + Z; + ircd.Write(":n!u@h PRIVMSG nick :Hello\xE6world"); + client.ReadUntil("Hello\xD0\xB6world"); + Z; + ircd.Write(":n!u@h PRIVMSG nick :Hello\xD0\xB6world"); + client.ReadUntil("Hello\xD0\xB6world"); + Z; +} + } // namespace