Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有时我们必须在显示中显示消息,这是 RTL 和 LTR 语言的混合。消息是 unicode 格式的。那么,unicode 是如何处理混音的呢?对平台有依赖吗?
该过程由此处描述的 Unicode 双向算法描述:http://www.unicode.org/reports/tr9/.
http://www.unicode.org/reports/tr9/
默认情况下,文本从左到右(0 级)。Unicode 具有特殊的字符代码来分隔级别 0(级别 1)内的 RTL 文本。您使用特殊字符在 RTL 等中分隔 LTR。我认为您最多可以有 61 个嵌入级别。
HTML 标签具有“dir”属性来指定默认方向。
该过程是平台中立的,但您将依赖 unicode 算法来使其正确。