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

html2text not compatible with utf-8

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5, 1.8.9, 1.9.5
    • Fix Version/s: 1.8.10, 1.9.6
    • Component/s: General
    • Labels:
      None
    • Environment:
      Both PHP4 and PHP5
    • Affected Branches:
      MOODLE_15_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE

      Description

      html2text function called indirectly from format_text_email function is not compatible with utf-8 charset encoding. html2text replaces all chr(160) bytes with ' ' at end of the function, while chr(160) in utf-8 encoding does not mean a white space. This causes some characters in utf-8 encoding such as 'da' (U+3060) characters in ja_utf8 garbled in text formatted email.

      — ../20050325/moodle/lib/html2text.php Sun Jan 23 11:18:50 2005

      +++ html2text.php Sat Mar 26 16:56:06 2005

      @@ -157,12 +157,12 @@

      $goodStr = wordwrap( $goodStr, 78 );

      //make sure there are no more than 3 linebreaks in a row and trim whitespace

      • $goodStr = str_replace(chr(160), ' ', $goodStr );

      +// $goodStr = str_replace(chr(160), ' ', $goodStr );

      $goodStr = preg_replace(/\r\n?/\f/, \n, $goodStr);

      $goodStr = preg_replace(/\n(\s*\n)

      {2}

      /, \n\n\n, $goodStr);

      $goodStr = preg_replace(/[ \t]+(\n/$)/, $1, $goodStr);

      $goodStr = preg_replace(/^\n*/\n*$/, '', $goodStr);

      • $goodStr = str_replace(chr(160), ' ', $goodStr );

      +// $goodStr = str_replace(chr(160), ' ', $goodStr );

      return $goodStr;

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  1 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

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