Check UTF-8 encoding, and convert strings to UTF-8

Handle conversion errors properly by inserting � instead.  Add a binary
header to provide portable way to write binary literals (I like them) Also
add a test file.  ref #2404
This commit is contained in:
Florent Le Coz
2013-11-09 06:01:47 +01:00
parent a418b6ed5d
commit ccebe901d7
6 changed files with 247 additions and 25 deletions
+7 -22
View File
@@ -1,31 +1,16 @@
#include <irc/irc_client.hpp>
#include <xmpp/xmpp_component.hpp>
#include <network/poller.hpp>
#include <xmpp/xmpp_parser.hpp>
#include <xmpp/xmpp_stanza.hpp>
#include <xmpp/xmpp_component.hpp>
#include <memory>
#include <xmpp/jid.hpp>
#include <irc/iid.hpp>
#include <iostream>
int main()
{
Poller p;
// Now I'm the bridge, creating an ircclient because needed.
std::shared_ptr<IrcClient> c = std::make_shared<IrcClient>();
p.add_socket_handler(c);
std::shared_ptr<IrcClient> d = std::make_shared<IrcClient>();
p.add_socket_handler(d);
std::shared_ptr<IrcClient> e = std::make_shared<IrcClient>();
p.add_socket_handler(e);
c->connect("localhost", "7877");
d->connect("localhost", "7878");
e->connect("localhost", "7879");
while (true)
p.poll();
std::shared_ptr<XmppComponent> xmpp_component =
std::make_shared<XmppComponent>("irc.localhost", "secret");
p.add_socket_handler(xmpp_component);
xmpp_component->start();
while (p.poll())
;
return 0;
}