Fix config.xml corruption when it contains multi-byte UTF8 characters.
[dcpomatic.git] / src / lib / encode_server.cc
index 92589c573d31429073efa0d530c005195c36f0e6..891b8caacae2d375f36f7a3e61499a5676a4f3c9 100644 (file)
@@ -295,8 +295,8 @@ EncodeServer::broadcast_received ()
                try {
                        auto socket = make_shared<Socket>();
                        socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), MAIN_SERVER_PRESENCE_PORT));
-                       socket->write (xml.length() + 1);
-                       socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
+                       socket->write (xml.bytes() + 1);
+                       socket->write ((uint8_t *) xml.c_str(), xml.bytes() + 1);
                } catch (...) {
 
                }
@@ -304,8 +304,8 @@ EncodeServer::broadcast_received ()
                try {
                        auto socket = make_shared<Socket>();
                        socket->connect (boost::asio::ip::tcp::endpoint (_broadcast.send_endpoint.address(), BATCH_SERVER_PRESENCE_PORT));
-                       socket->write (xml.length() + 1);
-                       socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
+                       socket->write (xml.bytes() + 1);
+                       socket->write ((uint8_t *) xml.c_str(), xml.bytes() + 1);
                } catch (...) {
 
                }