Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.2, 5.5.29
-
None
-
None
-
Windows
Description
The option MYSQL_AUTODETECT_CHARACTER_SET doesn't work with Windows GUI applications, since the function mysql_autodetect_character_set()tries to retrieve the current codepage via GetConsoleCP() windows api function.
In a GUI environment GetConsoleCP() returns 0 as current codepage.
5.x Versions are affected too.
Suggested fix:
=== modified file 'sql-common/client.c'
|
--- sql-common/client.c 2013-01-31 08:48:19 +0000
|
+++ sql-common/client.c 2013-03-06 09:11:33 +0000
|
@@ -2239,7 +2239,8 @@
|
#ifdef __WIN__
|
char cpbuf[64];
|
{
|
- my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP());
|
+ my_snprintf(cpbuf, sizeof(cpbuf), "cp%d",
|
+ (GetConsoleWindow()) ? (int) GetConsoleCP() : (int) GetACP());
|
csname= my_os_charset_to_mysql_charset(cpbuf);
|
}
|
#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO)
|