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