Fix config.xml corruption when it contains multi-byte UTF8 characters.
[dcpomatic.git] / src / lib / config.cc
index d38256673a8685cf169a24d643bdbaf0e084289b..cc9bd6ffdc177d619f810fffe61cc3ff45f0c619 100644 (file)
@@ -984,7 +984,7 @@ Config::write_config () const
                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());