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

GBK: bad results for SELECT "\{BF5C}\t'

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.3.12, 5.5.39, 10.0.13
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Multi-byte GBK characters with 0x5C do not work well in
      combination with surrounding backslash escapes.

      To repeat the bug, run a gnome-terminal session and set
      its character set to GBK:

      Terminal -> Character Coding -> Simplified Chinese (GBK)
      

      Run this command:

      LANG=zh_CN.gbk mysql --default-character-set=gbk test
      

      and execute this script:

      SET NAMES gbk;
      SELECT HEX('縗\t'),HEX('\縗\t');
      

      The output does not look correct:

      +-------------+--------------+
      | HEX('縗\t') | HEX('\縗\t') |
      +-------------+--------------+
      | BF5C09      | BF5C74       |
      +-------------+--------------+
      

      According to the manual section "String Literals":

      For all other escape sequences, backslash is ignored. That is, the escaped character is interpreted as if it was not escaped.

      That is '\縗' should be interpreted as just '縗 (0xBF5C),
      then '\t' should be interpreted as TAB (0x09).

      The expected result should be BF5C09 for both columns.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: