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

Provide tools to encode/decode mysql-encoded file system names

Details

    Description

      As non-ASCII letters are encoded in database directory names and table file nasenames there should be tools that can be used to perform conversion to human-readable unicode output (and back from unicode to encoded form?), either as SQL function, command line tool, or both.

      e.g. @6e2c@8a66@8cc7@6599@5eab' <-> 測試資料

      See also:

      and especially the comment from HeidiSQL on the later one.

      Attachments

        Issue Links

          Activity

            I believe that this is a documentation issue, not a code bug.

            The CONVERT function with the filename character set should already do the trick:

            SET NAMES utf8;
            SELECT CONVERT(CONVERT('測試資料' USING filename) USING binary),
            CONVERT(_filename '@6e2c@8a66@8cc7@6599@5eab' USING utf8);
            

            It will return the conversion:

            @6e2c@8a66@8cc7@6599	測試資料庫
            

            Note: these strings are from the description. The hexadecimal string had 5 encoded 5-byte characters, while the UTF-8 string only has 4 characters corresponding to the 4 first 5-byte characters.

            marko Marko Mäkelä added a comment - I believe that this is a documentation issue, not a code bug. The CONVERT function with the filename character set should already do the trick: SET NAMES utf8; SELECT CONVERT ( CONVERT ( '測試資料' USING filename) USING binary ), CONVERT (_filename '@6e2c@8a66@8cc7@6599@5eab' USING utf8); It will return the conversion: @6e2c@8a66@8cc7@6599 測試資料庫 Note: these strings are from the description. The hexadecimal string had 5 encoded 5-byte characters, while the UTF-8 string only has 4 characters corresponding to the 4 first 5-byte characters.

            Ok, that covers the SQL level part, but I still think we should have some binary tool, maybe a "myls", to be able to do the conversion on the command line without having to fall back to mysql -e 'SELECT CONVERT ...'

            Shouldn't be too hard to create a simple wrapper binary around the strconvert() function?

            hholzgra Hartmut Holzgraefe added a comment - Ok, that covers the SQL level part, but I still think we should have some binary tool, maybe a "myls", to be able to do the conversion on the command line without having to fall back to mysql -e 'SELECT CONVERT ...' Shouldn't be too hard to create a simple wrapper binary around the strconvert() function?
            serg Sergei Golubchik added a comment - - edited

            I've documented the filename charset in https://mariadb.com/kb/en/library/identifier-to-file-name-mapping/

            Let's keep this issue open until a tool is created. But it should be a Task, not a Bug.

            serg Sergei Golubchik added a comment - - edited I've documented the filename charset in https://mariadb.com/kb/en/library/identifier-to-file-name-mapping/ Let's keep this issue open until a tool is created. But it should be a Task, not a Bug.

            Is it a simple wrapper command that calls an existing function?
            So I'll work on this for my first contribution.

            example:
            terminal$ myls "測試資料"
            @6e2c@8a66@8cc7@6599
            terminal$ myls -r "@6e2c@8a66@8cc7@6599@5eab"
            測試資料庫

            tsasaki609 Takashi Sasaki added a comment - Is it a simple wrapper command that calls an existing function? So I'll work on this for my first contribution. example: terminal$ myls "測試資料" @6e2c@8a66@8cc7@6599 terminal$ myls -r "@6e2c@8a66@8cc7@6599@5eab" 測試資料庫

            People

              Unassigned Unassigned
              hholzgra Hartmut Holzgraefe
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.