I'm a bit confused with this issue! I'm building a bigger script and it was working in the ISE but not in a powershell console. I've managed to track it down to the [System.Uri]::EscapeDataString function which seems to be behaving differently between the different environments, for example in my powershell console () ' & ! are not being escaped, where as in the IDE they are all being escaped.
Am I missing something?
My test code:
[System.Uri]::EscapeDataString("/?:@%!$&'/*+,;=()")
ISE output:
%2F%3F%3A%40%25%21%24%26%27%2F%2A%2B%2C%3B%3D%28%29
Powershell Console output:
%2F%3F%3A%40%25!%24%26'%2F*%2B%2C%3B%3D()
Thanks!
Here is the difference, per the source: [System.UriParser].GetField('s_QuirksVersion', [Reflection.BindingFlags] 'Static, NonPublic').GetValue($null)
.
I marked the answer as community wiki because it appeared in the comments, causing the question to appear in searches for unanswered questions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With