Details

      Description

      XMLUtil.stripInvalidChars doesn't work with surrogate pairs.

      https://github.com/liferay/liferay-portal/blob/2db139e6216539a874a1f9753e250bfdd3db72cb/util-java/src/com/liferay/util/xml/XMLUtil.java#L97-L97

      This condition will always be false, it compares 0x10000 (65536) => 17th bit and c is char with only 16bits of size.

      Steps to reproduce:
      1, Make sure to use HSQL DB, utf8mb4 MySQL DB or UTF-8 PostgreSQL DB
      2, Create web content, into title add unicode surfer char - copy & paste from surfer.txt or from http://www.fileformat.info/info/unicode/char/1f3c4/browsertest.htm
      3, Save web content and edit again

      Expected result: Title still contains surfer
      Actual result: Surfer is stripped

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 15 weeks, 2 days ago

                Packages

                Version Package
                7.0.0 DXP FP14
                7.0.0 DXP SP3
                7.0.3 CE GA4
                7.0.X EE
                7.1.X
                Master