Fix files not being written as UTF-8

This commit is contained in:
oldmud0 2021-03-03 16:23:06 -06:00
parent e13e6183d9
commit 7d20de77d2
3 changed files with 5 additions and 1 deletions

View File

@ -990,6 +990,7 @@ void AOOptionsDialog::save_pressed()
if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
QIODevice::Text)) { QIODevice::Text)) {
QTextStream out(callwordsini); QTextStream out(callwordsini);
out.setCodec("UTF-8");
out << ui_callwords_textbox->toPlainText(); out << ui_callwords_textbox->toPlainText();
callwordsini->close(); callwordsini->close();
} }

View File

@ -4011,6 +4011,7 @@ void Courtroom::on_ooc_return_pressed()
} }
QTextStream out(&file); QTextStream out(&file);
out.setCodec("UTF-8");
foreach (chatlogpiece item, ic_chatlog_history) { foreach (chatlogpiece item, ic_chatlog_history) {
out << item.get_full() << '\n'; out << item.get_full() << '\n';

View File

@ -176,6 +176,7 @@ bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir)
QIODevice::Truncate)) { QIODevice::Truncate)) {
QTextStream out(&f_log); QTextStream out(&f_log);
out.setCodec("UTF-8");
out << p_text; out << p_text;
f_log.flush(); f_log.flush();
@ -205,6 +206,7 @@ bool AOApplication::append_to_file(QString p_text, QString p_file,
if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) { if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) {
QTextStream out(&f_log); QTextStream out(&f_log);
out.setCodec("UTF-8");
out << "\r\n" << p_text; out << "\r\n" << p_text;
f_log.flush(); f_log.flush();
@ -226,7 +228,7 @@ void AOApplication::write_to_serverlist_txt(QString p_line)
} }
QTextStream out(&serverlist_txt); QTextStream out(&serverlist_txt);
out.setCodec("UTF-8");
out << "\r\n" << p_line; out << "\r\n" << p_line;
serverlist_txt.close(); serverlist_txt.close();