#[no_mangle]
pub unsafe extern "C" fn encoding_mem_is_str_bidi(
buffer: *const u8,
len: usize,
) -> bool
Expand description
Checks whether a valid UTF-8 buffer contains code points that trigger right-to-left processing.
The check is done on a Unicode block basis without regard to assigned vs. unassigned code points in the block. Hebrew presentation forms in the Alphabetic Presentation Forms block are treated as if they formed a block on their own (i.e. it treated as right-to-left). Additionally, the four RIGHT-TO-LEFT FOO controls in General Punctuation are checked for. Control characters that are technically bidi controls but do not cause right-to-left behavior without the presence of right-to-left characters or right-to-left controls are not checked for. As a special case, U+FEFF is excluded from Arabic Presentation Forms-B.
§Undefined behavior
UB ensues if buffer
and buffer_len
don’t designate a valid memory block,
if buffer
is NULL
, or if the memory designated by buffer
and buffer_len
does not contain valid UTF-8. (If buffer_len
is 0
, buffer
may be bogus but
still has to be non-NULL
.)