Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.6.3, 4.7.0
-
None
-
Localized Windows versions.
Description
There is a problem with localized version of Windows. Many standard console tools write their output using OEM charset which does not same with local system charset. For example, for russian Windows, local 8-bit code page is CP1251, while the "console codepage" is CP866.
So, when reading and writing to QProcess I should convert QString to CP866 encoding.
Solutions:
1. create function QTextCodec::codecForConsole() which will return special value on Windows, and codecForLocale() in other operation systems.
We need to create big switch() for http://msdn.microsoft.com/en-us/library/dd317756(v=VS.85).aspx values which will convert microsoft values to MIB values. After which we shoudl return QTextCodec::codecForMib(...);
2. Implement QString::fromConsoleCP() and QString::toConsoleCP() which will use QTextCodec::codecForConsole() by default.
Note, that in theory, GetConsoleCP() and GetConsoleOutputCP() may return different encodings. QTextCodec::codecForConsole() should handle this.
Additional info:
According to MSDN, to get console code page number, I should call WinAPI function ::GetConsoleCP() for output charset and ::GetConsoleOutputCP() for input charset. Surprisingly, both functions return 0 on my system, but fortunately theres is ::GetOEMCP() which return correct codepage number
Attachments
Issue Links
- relates to
-
QTCREATORBUG-316 National compiler error messages unreadable
- Closed
-
QTCREATORBUG-23204 CLONE - National compiler error messages unreadable
- Closed