I\'m interested in setting some text into a UILabel
, and depending on the directionality of the language (e.g., Hebrew - right-to-left [RTL], English - left-to-righ
I think the scan loop in -getBaseDirection
should be for self.length
times instead of utf32data.length
in the accepted answer.
utf32data.length
is the size in bytes while sizeof(UTF32Char) == 4
, which would result in an overrun.
In action, the current code sporadically returns false positives for identical input, depending on what it overruns onto (maybe it'll segfault on a sufficiently bad day). Everything else seems to be working perfectly with the fix.