Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-313

Wrong behavior of Entities.unescape

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1, 2.2
    • 2.3
    • None
    • None

    Description

      Hi,

      There's seems to be a bug at Entities.unescape. Try for example StringEscapeUtils.unescapeHtml("& &"). It outputs "& &" instead of "& &". The problem is at this piece of code:

      if (entityValue == -1)

      { buf.append('&'); buf.append(entityName); buf.append(';'); }

      else

      { buf.append((char) (entityValue)); }

      i = semi;

      The method always skips to the next ";", even if it doesn't finds the entity value and then disregarding any entity that may be actually be referred inside.

      Regards,
      Thiago Souza

      Attachments

        1. LANG-313-test.patch
          0.5 kB
          Henri Yandell

        Activity

          People

            Unassigned Unassigned
            tsouza Thiago Souza
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: