Unicode strings in .Net with Hebrew letters and numbers

前端 未结 4 1353
梦如初夏
梦如初夏 2021-02-04 15:38

There is a strange behavior when trying to create string which contains a Hebrew letter and a digit. The digit will always be displayed left to the letter. For example:

<
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-04 16:06

    This is because of Unicode Bidirectional Algorithms. If I understand this correctly, the unicode character has an "identifier" that says where it should be when it's next to another word.

    In this case \u05E9 says that it should be to the left. Even if you do:

    var ab = string.Format("{0}{1}", a, b);

    You will still get it to the left. However, if you take another unicoded character such as \u05D9 this will be added to the right because that character is not said to be on the left.

    This is the layout of the language and when outputting this the layout enginge will output it according to the language layout.

提交回复
热议问题