From 806e6cda27cb4b333725d797a04ae8199fe97244 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 6 Mar 2013 13:30:40 +0100 Subject: 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) --- sql-common/client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql-common/client.c') 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) -- cgit v1.2.1