Page MenuHomePhabricator

Fix phutil_utf8_console_strlen() for combining characters
ClosedPublic

Authored by epriestley on Jun 15 2014, 1:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Dec 31, 10:05 PM
Unknown Object (File)
Thu, Dec 26, 5:15 PM
Unknown Object (File)
Tue, Dec 24, 9:22 AM
Unknown Object (File)
Thu, Dec 19, 2:41 PM
Unknown Object (File)
Fri, Dec 6, 4:48 AM
Unknown Object (File)
Fri, Dec 6, 1:04 AM
Unknown Object (File)
Dec 3 2024, 6:11 PM
Unknown Object (File)
Dec 3 2024, 6:11 PM
Subscribers

Details

Summary

See D9533. We currently count the length of combining characters incorrectly.

Instead, break the string into glyphs first, then only count the length of the base character in each glyph, ignoring combining characters.

Test Plan

Added some unit tests.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Fix phutil_utf8_console_strlen() for combining characters.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: joshuaspence.
joshuaspence edited edge metadata.

This fixes my issue.

This revision is now accepted and ready to land.Jun 15 2014, 5:42 PM
epriestley updated this revision to Diff 22891.

Closed by commit rPHUfe71010796fb (authored by @epriestley).