summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--quacker/quacker.cpp1
-rw-r--r--quackleio/gcgio.cpp7
2 files changed, 8 insertions, 0 deletions
diff --git a/quacker/quacker.cpp b/quacker/quacker.cpp
index 4b7f29c..69bf9f9 100644
--- a/quacker/quacker.cpp
+++ b/quacker/quacker.cpp
@@ -1319,6 +1319,7 @@ void TopLevel::reportAs(Quackle::ComputerPlayer *player)
Quackle::ComputerPlayer *clone = player->clone();
QTextStream stream(&file);
+ stream.setCodec(QTextCodec::codecForName("UTF-8"));
QuackleIO::StreamingReporter::reportGame(*m_game, clone, stream);
delete clone;
}
diff --git a/quackleio/gcgio.cpp b/quackleio/gcgio.cpp
index cafbf49..dfe23a0 100644
--- a/quackleio/gcgio.cpp
+++ b/quackleio/gcgio.cpp
@@ -43,6 +43,7 @@ Quackle::Game *GCGIO::read(QTextStream &stream, int flags)
bool gameStarted = false;
QString line;
+ stream.setCodec(QTextCodec::codecForName("ISO-8859-1"));
while (!stream.atEnd())
{
line = stream.readLine();
@@ -111,6 +112,11 @@ Quackle::Game *GCGIO::read(QTextStream &stream, int flags)
incompleteRack = Util::encode(rackString);
hasIncompleteRack = true;
}
+ else if (line.startsWith("#character-encoding"))
+ {
+ QString encoding{line.right(line.length() - 20).trimmed()};
+ stream.setCodec(QTextCodec::codecForName(encoding.toAscii()));
+ }
}
else if (line.startsWith(">"))
{
@@ -293,6 +299,7 @@ bool GCGIO::canRead(QTextStream &stream) const
void GCGIO::write(const Quackle::Game &game, QTextStream &stream)
{
Quackle::PlayerList players = game.players();
+ stream.setCodec(QTextCodec::codecForName("ISO-8859-1"));
for (Quackle::PlayerList::iterator it = players.begin(); it != players.end(); ++it)
{
stream << "#player" << (*it).id() + 1 << " " << Util::uvStringToQString((*it).abbreviatedName()) << " " << Util::uvStringToQString((*it).name()) << endl;