summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2015-04-28 21:59:40 +0200
committerDaniel Schürmann <daschuer@mixxx.org>2015-04-28 21:59:40 +0200
commite4eb68c6cd7d820ab558603e7ceab70fde841b64 (patch)
tree2b30b07c3bc5ca27428c794b644ff49619b6e4da /src/main.cpp
parent0df2436a6db28a5aa05f10bf4b5acafbc9cadd5f (diff)
An nother ty to fix console encoding
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fe2c882232..9139a2a9ce 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -279,18 +279,19 @@ int main(int argc, char * argv[])
//it seems like this code should be inline in MessageHandler() but for some reason having it there corrupts the messages sometimes -kousu 2/2009
#ifdef __WINDOWS__
- // Setup Windows console encoding
- // toLocal8Bit() returns the file encoding format
- // this does not necessarily match the console encoding
- // in case of a German Windows XP to 10 console encoding is cp850
- // where files encoding is cp1252
- // Qt has no solution for it https://bugreports.qt.io/browse/QTBUG-13303
- // http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using
- // We try to change the console encoding to file encoding
- // For a German windows we expect
- // LOCALE_IDEFAULTANSICODEPAGE "1252" // used by Qt toLocal8Bit
- // LOCALE_IDEFAULTCODEPAGE "850" // Console
- SetConsoleOutputCP(LOCALE_IDEFAULTANSICODEPAGE);
+ // Setup Windows console encoding
+ // toLocal8Bit() returns the file encoding format
+ // this does not necessarily match the console encoding
+ // in case of a German Windows XP to 10 console encoding is cp850
+ // where files encoding is cp1252
+ // Qt has no solution for it https://bugreports.qt.io/browse/QTBUG-13303
+ // http://stackoverflow.com/questions/1259084/what-encoding-code-page-is-cmd-exe-using
+ // We try to change the console encoding to file encoding
+ // For a German windows we expect
+ // LOCALE_IDEFAULTANSICODEPAGE "1252" // used by Qt toLocal8Bit
+ // LOCALE_IDEFAULTCODEPAGE "850" // Console
+ SetConsoleCP(LOCALE_IDEFAULTANSICODEPAGE);
+ SetConsoleOutputCP(LOCALE_IDEFAULTANSICODEPAGE);
#ifdef DEBUGCONSOLE
InitDebugConsole();
#endif
@@ -329,6 +330,10 @@ int main(int argc, char * argv[])
// if(QString("--no-visuals")==argv[i])
// bVisuals = false;
+#ifdef __WINDOWS__
+ qDebug() << "using CP" << LOCALE_IDEFAULTANSICODEPAGE << "for console";
+#endif
+
#ifdef __APPLE__
QDir dir(QApplication::applicationDirPath());