括号显示从右到左显示样式错误

| html代码
<html dir=\"rtl\">
<p>hello (world)</p>
</html>
您将看到如下页面:
(hello (world
但是,如果我将html代码更改为
<html dir=\"rtl\">
<p>hello (world) again</p>
</html>
然后,文本将正常显示:
 hello (world) again
任何人都可以解释为什么会这样吗? 如何解决第一个例子? 我的浏览器是Chrome     
已邀请:
您只需要在最后一个括号后添加LRM字符。 HTML实体:
&#x200E;
<html dir=\"rtl\">
<body>
<p>hello (world)&#x200E;</p>
</body></html>
这告诉浏览器将括号解释为从左到右的读数。     
或者更好的是可以在CSS中尝试
*:after {
    content: \"\\200E‎\";
}
    
在您的元素解决所有情况之前和之后,在CSS中添加特殊的rlm字符,我在Firefox和Chrome中遇到过这种情况:
*:after {
    content: \"\\200E‎\";
}
*:before {
    content: \"\\200E‎\";
}
    
(
之前使用
&rlm;
。 例如:
<html dir=\"rtl\">
<body>
<p>hello &rlm;(world)</p>
</body></html>
如果您使用的是javascript / svg Dom,则
 aText = $(\'<span>\').html(aText.replace(\"(\",\"&rlm;(\")).text();
 $(\"<p>\").html(aText);
用于其他特殊字符
function getRTLText(aText,aChar) {
        if ( aText != undefined && aText.replace){
            aChar = (aChar === undefined )?\"(\":aChar;
            aText = $(\'<span>\').html(aText.replace(aChar,\"&rlm;\"+aChar)).text();
        }
        return aText;
}
和通话功能
getRTLText(\"March / 2018\",\"/\");
    
这是从右到左文本(显然)的正确方括号渲染。本文提供了更多信息。 http://www.i18nguy.com/markup/right-to-left.html
dir
属性现已贬值。     
如果有人在WordPress中遇到此问题,则可以尝试以下修复: https://gist.github.com/dtbaker/b532e0e84a8cb7f22f26
function dtbaker_rtl_bracket_hack($content){
    if(is_rtl()){
        $content = preg_replace(\'#<p>([^<]+)\\)\\s*</p>#\',\'<p>$1)&#x200E;</p>\',$content);
        $content = preg_replace(\'#<p>\\s*\\(([^<]+)</p>#\',\'<p>&#x200E;($1</p>\',$content);
    }
    return $content;
}
add_filter(\'the_content\',\'dtbaker_rtl_bracket_hack\',100,1);
    

要回复问题请先登录注册