question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XML variable substitution - handling special characters problem

See original GitHub issue

XML variable substitution - handling special characters problem

When I use IIS Web App Deploy (Deployment Groups) and XML variable substitution to modify the web.config file I see that the string in the output file is different from the input. In my case I have this connectionstring that I specify under Variables when creating a new Release definition. The connectionstring should be updated in the web.config in the deployed web app:

Data Source=xxxx-xxxxx;Initial Catalog=xxxxxxxx;User Id=xxxxxxUser; password=‘E~FU:5&?77WY3wRU#:’

but this is changed to

Data Source=xxxx-xxxxx;Initial Catalog=xxxxxxxx;User Id=xxxxxxUser; password='E~FU:5&?77WY3wRU#:'

So it seams like this feature is not able to handle special characters?

also when I test the same string that you have inside vsts-tasks/Tasks/Common/webdeployment-common/Tests/L1XmlVarSub.ts

This string: Url=https://primary;Database=db1;ApiKey=11111111-1111-1111-1111-111111111111;Failover = {Url:‘https://secondary’, ApiKey:‘11111111-1111-1111-1111-111111111111’}

is changed to: Url=https://primary;Database=db1;ApiKey=11111111-1111-1111-1111-111111111111;Failover = {Url:'https://secondary', ApiKey:'11111111-1111-1111-1111-111111111111'}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Sarafiancommented, Jul 8, 2019

@MichalKoscielniak , ideally there should be no alteration made to the variable value set by the user. This was a bug and we fixed it. This caused the regression in your case. Please change your variable value to required value (MY_DB_DATA&ssl=true)

I think this is a wrong advice, because it moves the responsibility of transforming the data into variable container. For example, what if the content of the variable is going to be used both in JSON and XML? The content should be correct and should be adjusted/escaped based on the target file type. This is something that is implicit when working with XMLs.

1reaction
vincent1173commented, Apr 20, 2018

@MichalKoscielniak , ideally there should be no alteration made to the variable value set by the user. This was a bug and we fixed it. This caused the regression in your case. Please change your variable value to required value (MY_DB_DATA&ssl=true)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when trying to handle & character in XML message in ...
I need to encode special characters like < and > and & and ' and " in a webMethods service. To test it...
Read more >
Special characters are automatically converted to &#x01 and ...
My problem is, I have a stored procedure which picks this data and converts it into XML, but it is failing because the...
Read more >
Biztalk Special Character (&) to be replaced by variable ...
You problem is that you have invalid Xml so the first thing you need to do is work with the producer so then...
Read more >
How to handle special character in XML document
Hi All,. We are storing the following data in a text type process variable and mapping it to generate .xml document:- <Root> <name>ABC</name>...
Read more >
Handling special characters with FOR XML PATH
The only solution was to use replace in combination with a unique placeholder. I'm starting to hate XML… to solve this problem I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found