I thought about this some more and I still think it’s silly to do any sort of encoding behind the scenes, both as the default and especially because it cannot be turned off.
With the current auto-encoding behavior, there are certain strings which cannot be inserted into files during variable substitution because of the encoding behavior (assuming it hasn’t changed since my first message). At least without encoding, I can type what I want and Octopus can just do a literal, non-fancy substitution.
From Nick’s response above:
"(E.g. imagine Pass is a prompted variable - it would be strange to request the user enter their password using correct XML encoding :)" - it would be, but it’s also strange to ask them to write something such as msallmen stated, this still fails because with “&&” you do have to manually enter it as &&. So now I have to say “as long as your password doesn’t have two subsequent &s, you don’t have to XML encode it, but if it does, then you have to.” Additionally, if you have “Pass” used in one context that requires encoding and another that doesn’t, you just specify two variables with different values. I think that’s easy enough to do - there’s some minor duplication but that’s a fact I’m willing to accept for full control over my variable values.
All that said, it appears there is conflicting information - this entire thread is about automatic encoding during variable substitution, but Vanessa has stated that no encoding is performed on variable substitution. This can’t be true based on the behaviors reported here, as it appears encoding is performed differently based on Octopus’s best guess of the variable’s target use.
I just don’t understand why any substitution other than literal substitution is the default. This behavior to “do what is right” will never have enough context to really do what is right in all situations. In a world with no context, it is doing what is wrong - no one says string xx = “jkl&”; in any programming language and expects it to be XML-encoded when they read it later unless they explicitly call something to convert it. I think that stands here.
I know you can’t change the default behavior for backwards compatibility, but please, please, give us an option (even Octopus-wide) to just turn off the encoding behavior.