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

shorten_text doesn't work for oriental languages

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 1.6
    • Fix Version/s: 1.6.3, 1.7
    • Component/s: Other
    • Labels:
      None
    • Environment:
      All
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE

      Description

      Japanese and Chinese languages have no interword spaces, and text can be broken (almost) anywhere. So function shorten_text in lib/moodlelib.php must be rewritten:

      if ($stopzone) {

      if ($char == '.' or $char == ' ' or ord($char) >= 0xE0)

      { $truncate = $i; // not $i+1; break 2; }

      }

      if text is encoded in UTF-8. Note that a 0xE0-or-higher byte starts a three-byte (or longer) chacacter, which is almost always a Japanese/Chinese letter, and this hack should not affect Moodle's behavior for European languages.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Oct/06