Hi,
are you sure the code is not encoded? Or having a different case for the
?
As replacing it should work:
my test code:
1. '{% x = "X Y Z" @%}'
2. '{% x.Replace(" ", "_").ToString() @%}'
3. '{% x.Replace(" ", " ").ToString() @%}'