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

The email bodies which are written by HTML editor sent by forum_cron() is broken in Multibyte character set environment

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 1.9.5, 2.0
    • Fix Version/s: 1.9.6, 2.0
    • Component/s: Language, Libraries
    • Labels:
      None
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      The cause of this problem is utf8_encode() function in lib/html2text.php.(since 12th/Jun/2009)

      function _convert()
      {
      // Variables used for building the link list
      $this->_link_count = 0;
      $this->_link_list = '';

      $text = trim(stripslashes($this->html));

      // Convert <PRE>
      $this->_convert_pre($text);

      // Run our defined search-and-replace
      $text = preg_replace($this->search, $this->replace, $text);
      $text = preg_replace_callback($this->callback_search, array(&$this, '_preg_callback'), $text);

      // Replace known html entities
      // $text = utf8_encode(html_entity_decode($text)); // Here!!!
      $text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');

      // Remove unknown/unhandled entities (this cannot be done in search-and-replace block)
      $text = preg_replace('/&[^&;]+;/i', '', $text);

      utf8_encode() function converts characters from ISO-8859-1 to UTF-8.
      Then, Multibyte UTF-8 characters were convereted to wrong unexpected characters...

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  21/Oct/09