HTML中部分彩色的阿拉伯字 [英] Partially colored Arabic word in HTML

查看:125
本文介绍了HTML中部分彩色的阿拉伯字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不会说阿拉伯语,但我需要在我们的网站上特别支持阿拉伯语。我需要将部分阿拉伯语单词放在< span> 中,其风格与其他单词不同。当我输入两个字符شس时,它们被组成字شس,但是当我使用HTML标记时

 < span>ش< / span> 

这些字母不会连在输出中。

< img src =https://i.stack.imgur.com/IGAj2.jpgalt =在这里输入图片描述>



在图片中,所需的输出在第二行,实际输出在第一行。



编辑: 它适用于Firefox,不适用于Chrome / Safari。

解决方案

插入一个零宽度的joiner(例如使用实体引用 & zwj; < code>< span>&通常,每个的开始和结束处的零宽度连接符跨度 / code>元素以及(只是为了更确定)在e之前和之后ach span 元素,在文本应该具有草体(加入)行为并且 span 可能会破坏它的情况下这个问题在双向文本页面。



更新:不幸的是,即使& zwj; 也无济于事在当前版本的WebKit浏览器上。他们似乎将HTML标记视为突破加入行为,无论如何。



更新2:如@ NasserAl-Wohaibi的评论中所述,新问题可以通过两次使用& zwj; 来解决。但是,在目前的Windows(5.1.7)中,Windows并没有帮助;事实上,它甚至显示ش& zwj;س错误,而如果没有木工,它会正确显示شس p>

I don't speak Arabic, but I need specific support for Arabic on our web. I need parts of Arabic words to be in a <span> with a different style than the rest of word. When I type two characters ش and س, they are composed into word شس, but when I use HTML markup

<span>ش</span>س

these letters are not concatenated right in the output.

In the picture, desired output is on second line, actual output is on first line.

EDIT: It works on Firefox, but does not work in Chrome/Safari.

解决方案

Insert a zero-width joiner (e.g. using the entity reference &zwj;) at the end of the span element content: <span>ش&zwj;</span>س.

More generally, the zero-width joiners at the start and end of each span element as well as (just to be more sure) before and after each span element, in situations where the text should have cursive (joining) behavior and span may break it.

The issue is discussed and illustrated on the Bidirectional text page by Andreas Prilop.

Update: Unfortunately, it seems that even &zwj; does not help on current versions of WebKit browsers. They seem to treat HTML markup as breaking joining behavior, no matter what.

Update 2: As described in @NasserAl-Wohaibi’s comment, the new problem can be solved by using &zwj; twice. However, in current Safari (5.1.7) for Windows, it does not help; in fact, it displays even ش&zwj;س wrong whereas without the joiner, it shows شس correctly.

这篇关于HTML中部分彩色的阿拉伯字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆