diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2013-03-06 13:30:40 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2013-03-06 13:30:40 +0100 |
commit | 806e6cda27cb4b333725d797a04ae8199fe97244 (patch) | |
tree | 25b450a6580944fc91158d4ec7d58d5b30271f04 /sql-common | |
parent | 421c885446ddf7a996cecb0d3831f7b1a10d3701 (diff) | |
download | mariadb-git-806e6cda27cb4b333725d797a04ae8199fe97244.tar.gz |
MDEV-4249 : when autodetecting default client charset on Windows, fallback to GetACP() whenever GetConsoleCP() returns 0 (i.e appkication does not have a console , which is the case for GUI apps, Windows services etc)
Diffstat (limited to 'sql-common')
-rw-r--r-- | sql-common/client.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sql-common/client.c b/sql-common/client.c index c8ec031c95c..c257c7c96a7 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -2198,7 +2198,10 @@ mysql_autodetect_character_set(MYSQL *mysql) #ifdef __WIN__ char cpbuf[64]; { - my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int) GetConsoleCP()); + UINT cp= GetConsoleCP(); + if (cp == 0) + cp= GetACP(); + my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); csname= my_os_charset_to_mysql_charset(cpbuf); } #elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) |