mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-31 16:20:22 -05:00
Fix stdin/stdout encoding on Windows. (#2425)
QTextStream uses the system default locale, but this breaks in various situations: (1) It does not work on the native Windows shell (cmd.exe, Powershell), since the default Windows locale is Windows-1252, but the shell uses Windows-850. (2) It also breaks on *nix systems where the locale is Latin1 or C, which is the case for most CI systems or build servers. We allow overriding the detected codec by setting the ENCODING_OVERRIDE environment variable, but otherwise prefer Windows-850 on Windows and UTF-8 on any other system, even if LANG is set to something else. This resolves #2413
This commit is contained in:
parent
c9cab250c7
commit
7263dcddfe
19 changed files with 180 additions and 61 deletions
|
|
@ -23,8 +23,8 @@
|
|||
#include <QCommandLineParser>
|
||||
#include <QCoreApplication>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "cli/TextStream.h"
|
||||
#include "cli/Utils.h"
|
||||
#include "core/Database.h"
|
||||
#include "core/Entry.h"
|
||||
|
|
@ -44,7 +44,7 @@ Remove::~Remove()
|
|||
|
||||
int Remove::execute(const QStringList& arguments)
|
||||
{
|
||||
QTextStream out(Utils::STDERR, QIODevice::WriteOnly);
|
||||
TextStream out(Utils::STDERR, QIODevice::WriteOnly);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::tr("main", "Remove an entry from the database."));
|
||||
|
|
@ -73,8 +73,8 @@ int Remove::execute(const QStringList& arguments)
|
|||
|
||||
int Remove::removeEntry(Database* database, const QString& databasePath, const QString& entryPath)
|
||||
{
|
||||
QTextStream out(Utils::STDOUT, QIODevice::WriteOnly);
|
||||
QTextStream err(Utils::STDERR, QIODevice::WriteOnly);
|
||||
TextStream out(Utils::STDOUT, QIODevice::WriteOnly);
|
||||
TextStream err(Utils::STDERR, QIODevice::WriteOnly);
|
||||
|
||||
QPointer<Entry> entry = database->rootGroup()->findEntryByPath(entryPath);
|
||||
if (!entry) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue