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

MYSQL_AUTODETECT_CHARACTER_SET option doesn't work with Windows GUI applications

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.2, 5.5.29
    • Fix Version/s: 5.5.31
    • Component/s: None
    • Labels:
      None
    • Environment:
      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)
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h