1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[code] Explicitly set UTF-8 codec when using QTextStream.

Fixes encoding issues on Windows.

Closes #769
This commit is contained in:
nowrep 2013-02-20 19:50:59 +01:00
parent ecfb784c92
commit 3b3e62cd76
6 changed files with 10 additions and 1 deletions

View File

@ -32,6 +32,7 @@ Version 1.4.0
* fixed possible crash in saving page screen of a really long page
* fixed showing window in fullscreen with XFCE
* X11: fixed Ctrl+Q shortcut for DEs other than KDE and Gnome
* windows: fixed downloading utf-8 encoded adblock subscriptions
* windows: improved installer allows registering as default web browser
* windows: check and set as default browser from preferences
* mac: fixed not working global menu after closing browser window

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -213,6 +213,7 @@ void AdBlockManager::load()
}
QTextStream textStream(&file);
textStream.setCodec("UTF-8");
QString title = textStream.readLine(1024).remove(QLatin1String("Title: "));
QUrl url = QUrl(textStream.readLine(1024).remove(QLatin1String("Url: ")));

View File

@ -103,6 +103,7 @@ void AdBlockSubscription::loadSubscription(const QStringList &disabledRules)
}
QTextStream textStream(&file);
textStream.setCodec("UTF-8");
// Header is on 3rd line
textStream.readLine(1024);
textStream.readLine(1024);
@ -422,6 +423,7 @@ void AdBlockCustomList::saveSubscription()
}
QTextStream textStream(&file);
textStream.setCodec("UTF-8");
textStream << "Title: " << title() << endl;
textStream << "Url: " << url().toString() << endl;
textStream << "[Adblock Plus 1.1.1]" << endl;

View File

@ -166,6 +166,7 @@ void FtpSchemeReply::processData()
{
open(ReadOnly | Unbuffered);
QTextStream stream(&m_buffer);
stream.setCodec("UTF-8");
stream << m_ftp->readAll();

View File

@ -43,6 +43,7 @@ SpellCheckDialog::SpellCheckDialog(QWidget* parent)
else {
QString word;
QTextStream stream(&file);
stream.setCodec("UTF-8");
while (!stream.atEnd()) {
stream >> word;
@ -120,6 +121,7 @@ void SpellCheckDialog::saveSettings()
}
QTextStream stream(&file);
stream.setCodec("UTF-8");
int count = ui->userDictList->count();
for (int i = 0; i < count; ++i) {

View File

@ -99,6 +99,7 @@ void Speller::initialize()
else {
QString word;
QTextStream stream(&m_userDictionary);
stream.setCodec("UTF-8");
while (!stream.atEnd()) {
stream >> word;
putWord(word);
@ -204,6 +205,7 @@ void Speller::addToDictionary()
}
QTextStream stream(&m_userDictionary);
stream.setCodec("UTF-8");
stream << word << endl;
m_userDictionary.close();
}