Text formating functions disrupt right-to-left flow in 'substitute' function

Discussion created by wladdy on Nov 10, 2018
Latest reply on Nov 15, 2018 by TSGal

I want to color in blue a specific substring within a string. For example, this works fine:



     Substitute (

          "abcdef" ;

          "cd" ;

          TextColor ("cd" ; RGB (0;0;255))  )


My problem arises when the input string is in a right-to-left language, such as arabic or hebrew.



Substitute     (

"אבגדהו" ;

"גד" ;

TextColor ("גד" ; RGB (0;0;255))  )


This gets the color right but outputs "הוגדאב".

This is not what I want, as the substrings before and after the substitution are inverted.


This behavior has something to do with the text format function. Indeed, without 'TextColor' there is no inversion and the result is fine. For example:



Substitute (

"אבגדהו" ;

"גד" ;

"שת"  )


This outputs "אבשתהו", as in the first example with the latin characters.


Please note that I did set the default language of all fields involved in the calculation to "Hebrew".

I also tried to insert at various spots special Unicode invisible RTL markers, such as the RTL mark (code 8207), the RTL isolate (code 8295), the RTL embedding (code 8235) and the RTL override (code 8238). Nothing helped.


Attached to this post is a  simple database that I made to investigate the issue.


Any help to solve this problem or to point me in the right direction would be immensely appreciated.

Thank you very much in advance.