Commit 806e6cda authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-4249 : when autodetecting default client charset on Windows, fallback to...

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)
parent 421c8854
...@@ -2198,7 +2198,10 @@ mysql_autodetect_character_set(MYSQL *mysql) ...@@ -2198,7 +2198,10 @@ mysql_autodetect_character_set(MYSQL *mysql)
#ifdef __WIN__ #ifdef __WIN__
char cpbuf[64]; 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); csname= my_os_charset_to_mysql_charset(cpbuf);
} }
#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) #elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment