File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -111,17 +111,22 @@ def self.nfc_one(string)
111111 start = nfd_string [ 0 ]
112112 last_class = CLASS_TABLE [ start ] -1
113113 accents = ''
114+ result = ''
114115 nfd_string [ 1 ..-1 ] . each_char do |accent |
115116 accent_class = CLASS_TABLE [ accent ]
116117 if last_class <accent_class and composite = COMPOSITION_TABLE [ start +accent ]
117118 start = composite
119+ elsif accent_class == 0
120+ result += start +accents
121+ start = accent
122+ accents = ''
123+ last_class = -1
118124 else
119125 accents << accent
120126 last_class = accent_class
121127 end
122128 end
123- accents = nfc_one ( accents ) if accents . length >1 # TODO: change from recursion to loop
124- hangul_comp_one ( start +accents )
129+ hangul_comp_one ( result +start +accents )
125130 end
126131
127132 def self . normalize ( string , form = :nfc )
You can’t perform that action at this time.
0 commit comments