Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4249

MYSQL_AUTODETECT_CHARACTER_SET option doesn't work with Windows GUI applications

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.2, 5.5.29
    • 5.5.31
    • 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)

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.