if (!f) {
throw FileError (_("Could not open file for writing"), tmp);
}
- checked_fwrite (s.c_str(), s.length(), f, tmp);
+ checked_fwrite (s.c_str(), s.bytes(), f, tmp);
fclose (f);
boost::filesystem::remove (config_file());
boost::filesystem::rename (tmp, config_file());
/* Send XML metadata */
auto xml = doc.write_to_string ("UTF-8");
socket->write (xml.length() + 1);
- socket->write ((uint8_t *) xml.c_str(), xml.length() + 1);
+ socket->write ((uint8_t *) xml.c_str(), xml.bytes() + 1);
/* Send binary data */
LOG_TIMING("start-remote-send thread=%1", thread_id ());
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 (...) {
}
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 (...) {
}
*/
setup_test_config ();
}
+
+
+BOOST_AUTO_TEST_CASE (config_write_utf8_test)
+{
+ boost::filesystem::remove_all ("build/test/config.xml");
+ boost::filesystem::copy_file ("test/data/utf8_config.xml", "build/test/config.xml");
+ Config::override_path = "build/test";
+ Config::drop ();
+ Config::instance()->write();
+
+ check_file ("test/data/utf8_config.xml", "build/test/config.xml");
+}
+
-Subproject commit 3eb05f5989dcb601bde60c4badc95b66cf46a0cb
+Subproject commit 4c70bad1c502a43d2db17d6d03476e904eb757ce