Merge pull request #482 from AttorneyOnline/fix/log-utf8
Fix files not being written as UTF-8
This commit is contained in:
		
						commit
						a171ad9f65
					
				@ -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();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -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';
 | 
				
			||||||
 | 
				
			|||||||
@ -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();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user