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

shorten_text doesn't work for oriental languages

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 1.6
    • 1.6.3, 1.7
    • Other
    • None
    • All
    • MOODLE_16_STABLE
    • 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

            martinlanghoff Martín Langhoff
            imported Imported
            Nobody Nobody
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10/Oct/06