Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-35412

Date Selector causes a json_encode error

XMLWordPrintable

    • MOODLE_23_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MDL-35412-master
    • Hide

      Test pre-requisites

      • To be tested on a Windows server
      • Install the Japanese language pack

      Test 1

      1. Go to your home page and switch to English language pack
      2. Go to the calendar, and add a new event
      3. Make sure that the pop-up date selector correctly displays each month
        • Month and days are correctly translated (February is not March, check that you'll never have two similar names while going from one month to another)
        • No errors are displayed during the process

      Test 2

      1. Go to your home page and switch to Japanese
      2. Go to the calendar, and add a new event
      3. Make sure that the pop-up date selector correctly displays each month
        • Month and days are correctly translated
        • No errors are displayed during the process
      Show
      Test pre-requisites To be tested on a Windows server Install the Japanese language pack Test 1 Go to your home page and switch to English language pack Go to the calendar, and add a new event Make sure that the pop-up date selector correctly displays each month Month and days are correctly translated (February is not March, check that you'll never have two similar names while going from one month to another) No errors are displayed during the process Test 2 Go to your home page and switch to Japanese Go to the calendar, and add a new event Make sure that the pop-up date selector correctly displays each month Month and days are correctly translated No errors are displayed during the process

      Opening this issue to investigate and fix the following reported by Yamashita Kōichi on MDL-35171.

      Since Moodle 2.3.2, "json_encode(): Invalid UTF-8 sequence in argument" occurs when editing quizzes etc., on Windows servers with some locales (e.g. Japanese). Changing the code in formslib like below fixes that.

      'mon' => userdate(strtotime("Monday"), '%a'), // 5th Jan 1970 at 12pm
      'january' => userdate(strtotime("January"), '%B'), // 1st Jan 1970 at 12pm

      My environment is: Moodle 2.3.2, Windows 7, IIS 7.5, PHP 5.3.14 Zend Server, debug is set to DEVELOPER.

      I get errors when editing a quiz (date selector is used for Timing > Open/Close the quiz), in some locales (en is OK but ja, fr, de all have errors).
      strftime can return results only in multibyte encoding on Windows so we need to convert back to UTF-8 for use in moodle. (userdate() in moodlelib.php does that.)

            fred Frédéric Massart
            k-yama Koichi Yamashita
            Jason Fowler Jason Fowler
            Sam Hemelryk Sam Hemelryk
            Michael de Raadt Michael de Raadt
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.