Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.1.0) is shown here.
reorder_characters(codepoints)
protected
Re-order codepoints so the string becomes canonical
# File activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb, line 466
def reorder_characters(codepoints)
length = codepoints.length- 1
pos = 0
while pos < length do
cp1, cp2 = UCD[codepoints[pos]], UCD[codepoints[pos+1]]
if (cp1.combining_class > cp2.combining_class) && (cp2.combining_class > 0)
codepoints[pos..pos+1] = cp2.code, cp1.code
pos += (pos > 0 ? -1 : 1)
else
pos += 1
end
end
codepoints
end