Uploaded image for project: 'Blesta Core'
  1. Blesta Core
  2. CORE-1071

Support Manager: Use of substr() does not truncate using multi-byte UTF-8 encoding

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: 3.0.0
    • Fix Version/s: 3.2.0-b1
    • Component/s: Plugins
    • Labels:
      None

      Description

      Ticket summaries in the admin and client interfaces may not display all characters due to truncation on non-multi-byte UTF-8 characters.

        Issue Links

          Activity

          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          Fixed

          Show
          tyson Tyson Phillips (Inactive) added a comment - Fixed
          Hide
          cody Cody Phillips (Inactive) added a comment -

          The solution may be some combination of substr, strpos, and wordwrap.

          pseudo code:

          substr($str, 0, strpos(wordwrap($str, 40), "\n"))

          That is, break on word, and cut on new line.

          Show
          cody Cody Phillips (Inactive) added a comment - The solution may be some combination of substr, strpos, and wordwrap. pseudo code: substr($str, 0, strpos(wordwrap($str, 40), "\n")) That is, break on word, and cut on new line.
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          The current substr() usage on multibype characters causes tickets to not be refreshed via AJAX due to the json encoding. Need to test this with Cody's fix

          Show
          tyson Tyson Phillips (Inactive) added a comment - The current substr() usage on multibype characters causes tickets to not be refreshed via AJAX due to the json encoding. Need to test this with Cody's fix
          Hide
          tyson Tyson Phillips (Inactive) added a comment - - edited

          The following will not fix the issue because it breaks on the last space character:
          $summary = substr($summary, 0, strpos(wordwrap($summary, 40, "\n"), " ")) . "...";

          Note that the support manager ticket listing may experience this issue and cause the page to fail to load via AJAX. A related solution would be necessary.

          Show
          tyson Tyson Phillips (Inactive) added a comment - - edited The following will not fix the issue because it breaks on the last space character: $summary = substr($summary, 0, strpos(wordwrap($summary, 40, "\n"), " ")) . "..."; Note that the support manager ticket listing may experience this issue and cause the page to fail to load via AJAX. A related solution would be necessary.
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          This fix depends on the completion of CORE-1137.

          Show
          tyson Tyson Phillips (Inactive) added a comment - This fix depends on the completion of CORE-1137 .
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          This will now truncate based on the number of words.

          Show
          tyson Tyson Phillips (Inactive) added a comment - This will now truncate based on the number of words.
          Hide
          cody Cody Phillips (Inactive) added a comment -

          Tyson Phillips Can this be updated such that we're not creating the DataStructureString object in the view, but instead pass that object to the view from the controller via set()?

          Show
          cody Cody Phillips (Inactive) added a comment - Tyson Phillips Can this be updated such that we're not creating the DataStructureString object in the view, but instead pass that object to the view from the controller via set()?
          Hide
          tyson Tyson Phillips (Inactive) added a comment -

          Done

          Show
          tyson Tyson Phillips (Inactive) added a comment - Done

            People

            • Assignee:
              tyson Tyson Phillips (Inactive)
              Reporter:
              tyson Tyson Phillips (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                23/Apr/14