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

JSON_ARRAY() - bad output with some UTF8 characters

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.8
    • 10.2.9
    • Character Sets, JSON
    • None
    • CentOS Linux 7.3

    Description

      I compared the output from JSON_ARRAY () in mariaDB and json_encode () in php-5.6.31.

      I have found that some of the Czech accent characters are not properly converted to number code (connection setting: SET NAMES UTF8):

      $row = $this->database->query("SELECT JSON_ARRAY('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú') AS json_data")->fetch();
       
      $json_test = [
          'mysql' => $row->json_data,
           'php' => json_encode('1. ě 2. š 3. č 4. ř 5. ž 6. ý 7. á 8. í 9. é 10. ů 11. ú'),
      ];
       
      die(var_dump($json_test));
       
      
      

      And here is output:

      array(2) {
        ["mysql"]=>
        string(90) "["1. \u011B 2. \u0161 3. \u010D 4. \u0159 5. \u017E 6. ? 7. ? 8. ? 9. ? 10. \u016F 11. ?"]"
        ["php"]=>
        string(113) ""1. \u011b 2. \u0161 3. \u010d 4. \u0159 5. \u017e 6. \u00fd 7. \u00e1 8. \u00ed 9. \u00e9 10. \u016f 11. \u00fa""
      }
      
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              chaky Michal Hucik
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.