Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-71894

Hangul composition bug

    XMLWordPrintable

Details

    • All
    • 182afbe335a8bd494a86defc5d32da3ae8ec7920 (qt/qtbase/dev) 5c0cb9346bdb3e8d48d0e85c0b7a904c9571118a (qt/qtbase/6.1) 96bc254c3b6c0f4291a46cd1ffb9ea22e71c59b0 (qt/qtbase/6.2) e9139061986cd9dc1f4464e3db4ed3190c3ab5f8 (qt/tqtc-qtbase/5.15)

    Description

      I was involved to fix a similar bug in Python [1] and Ruby [2] , I found Qt also has bug code.

      We should patch qt5/qtbase/src/corelib/tools/qchar.cpp like this:

      --- D:/backup/desktop/111.cpp	Mon Nov 19 12:22:02 2018
      +++ D:/backup/desktop/222.cpp	Tue Nov 20 12:10:00 2018
      @@ -1805,7 +1805,7 @@
       
       static uint inline ligatureHelper(uint u1, uint u2)
       {
      -    if (u1 >= Hangul_LBase && u1 <= Hangul_SBase + Hangul_SCount) {
      +    if (u1 >= Hangul_LBase && u1 < Hangul_SBase + Hangul_SCount) {
               // compute Hangul syllable composition as per UAX #15
               // hangul L-V pair
               const uint LIndex = u1 - Hangul_LBase;
      @@ -1818,7 +1818,7 @@
               const uint SIndex = u1 - Hangul_SBase;
               if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) {
                   const uint TIndex = u2 - Hangul_TBase;
      -            if (TIndex <= Hangul_TCount)
      +            if (TIndex < Hangul_TCount && TIndex != 0)
                       return u1 + TIndex;
               }
           }
      

      There was a change of Unicode Standard's demonstration code.

      Before Unicode 4.1.0 (draft), here is: TBase <= u2 <= TBase+TCount
      see: http://www.unicode.org/reports/tr15/tr15-24.html#hangul_composition

      After Unicode 4.1.0, here is TBase < u2 < TBase+TCount, which in line with Unicode 11.0 [3]
      see: http://www.unicode.org/reports/tr15/tr15-25.html#hangul_composition

      This change happened in 2005.

      --------------
      [1]
      Python issue: https://bugs.python.org/issue29456
      Python fix: https://github.com/python/cpython/commit/d134809cd3764c6a634eab7bb8995e3e2eff14d5

      [2]
      Ruby issue: https://redmine.ruby-lang.org/issues/14934
      Ruby fix: https://github.com/ruby/ruby/commit/a7acec675051f8ed49bbc3ab992ac668e5c29fcf

      [3]
      Unicode 11.0.0 https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf
      Please search "Hangul Composition" in this pdf file.

      Attachments

        For Gerrit Dashboard: QTBUG-71894
        # Subject Branch Project Status CR V

        Activity

          People

            Eddy Edward Welbourne
            malin Ma Lin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes