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

Dataformat - HTML writer lack content type and charset tag in HTML head

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.1, 3.2.3, 3.3
    • Fix Version/s: 3.2.5, 3.3.2
    • Component/s: Other
    • Labels:
    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. Head to a course with participants having non-ascii names (The generate may do that for you)
      2. Create logs for one of these users
      3. Visit the logs report, and download it as HTML
      4. Confirm that the names are properly displayed (the HTML charset did its job)
      Show
      Head to a course with participants having non-ascii names (The generate may do that for you) Create logs for one of these users Visit the logs report, and download it as HTML Confirm that the names are properly displayed (the HTML charset did its job)
    • Workaround:
      Hide

      Add content type and charset tag in HTML head in
      /dataformat/html/classes/writer.php , like

      public function write_header($columns) {
      echo "<!DOCTYPE html><html>";
      echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" ;
      echo \html_writer::tag('title', $this->filename);
      echo "<style>

      Show
      Add content type and charset tag in HTML head in /dataformat/html/classes/writer.php , like public function write_header($columns) { echo "<!DOCTYPE html><html>"; echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" ; echo \html_writer::tag('title', $this->filename); echo "<style>
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-56629-master

      Description

      When I used function of download full report as HTML table of statistics of Offline Quiz.
      Generated HTML file lacks content type and charset tag in head, like:
      -------------------------------------
      <!DOCTYPE html>
      <html><title>NCNU Moodle 2.9 測試課程-Offline quiz-completestats</title>
      -------------------------------------
      So in some browser used non-UTF8 charset to display html page.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fred Frédéric Massart
              Reporter:
              wcchien Chien Wen-Chang(簡文章)
              Peer reviewer:
              Brendan Heywood
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Ankit Agarwal
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Sep/17