BD16 and N0 decide every bracket in a mixed-direction line. A rule-by-rule walkthrough of UAX #9, from the explicit status stack through N0 clause resolution to the L2 reversal passes and L4 mirroring.
A byte-order mark, a line-ending convention, and a declared character encoding quietly decide what every character in your plain text file becomes. Here is the eight-step audit that catches them all.