3 ms·
It does very limited validation. It is very purpose specific, its ultimate objective to check whether the first character of a UTF-8 string is RTL or LTR, for l
by lultimouomo 4y ago
It does very limited validation. It is very purpose specific, its ultimate objective to check whether the first character of a UTF-8 string is RTL or LTR, for layout purporses. To do this we convert N UTF-8 bytes to a single UTF-32 code pointer, after which we check its value against a simple table. If we can't decode the code point from the UTF-8 encoding, we return NULL which falls (for our purposes) in the LTR category. The UTF-8 string is left untouched and unvalidated and passed as-is outside of our library, where it's someone else's problem.
(The function is defined as static in the cpp file where RTL detection is done, with a warning that is not general purpose)