cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DJLilly
Level 2

XML encoding strings

We have an issue with writing strings into an XML file. A dialog in our install asks for a username and then stores it in an XML config file (which has been installed by the installer).

If a user enters a name such as "doom&gloom", this is then written as it is - which of course breaks the XML. Is there a way to escape this correctly from within InstallScript so that it is written as "doom&gloom"?

I could be missing something but I can't find an equivalent of Asc() or charCodeAt() in InstallScript.
Labels (1)
0 Kudos
(1) Reply
DJLilly
Level 2

Ha - just noticed that the forum has "fixed" my strings so the question looks wrong: the desired output should be
doom& ;gloom
^ - Ignore this space, needed to prevent the forum "fixing" it.


Anyway, I've worked it out - by using array syntax (such as "szString[nPos]") to get the character at a position, I can then compare it to character values using STRTOCHAR() if necessary. I can format the value into my output string with Sprintf() and end up with the correct formatted string.
0 Kudos