C# .Replace() method does not work correctly with Arabic language

Using this answer: This

I've edited your code for that:

public static void Main()
{
    Console.WriteLine("Hello World");
    var replace = "سنغافورة";
    var input = "York Hotel في [CITY] – عروض الغرف، صور وتقييمات";
    Console.WriteLine(input);
    var lefttoright = ((Char)0x200E).ToString();
    var final = input.Replace("[CITY]", lefttoright + replace + lefttoright );
    Console.WriteLine(final);

}

And the output is:

Hello World
York Hotel في [CITY] – عروض الغرف، صور وتقييمات
York Hotel في ‎سنغافورة‎ – عروض الغرف، صور وتقييمات

Citing @Takarii:

Char 0x200E is a special character that tells the following text to read left to right see here for more information on the character.

Tags:

C#