From vince at softrock.co.uk Sun Dec 11 18:33:17 2011 From: vince at softrock.co.uk (Vince M Hudd) Date: Sun, 11 Dec 2011 18:33:17 +0000 Subject: [Webchange-list] Quotation marks in strings within scripts Message-ID: I found a bug! Well, it's about time someone did! ;) In the old versions of WebChange if you wanted to include a quotation mark, used to enclose strings in the script language (and, for example, URIs in anchors in your HTML, you could do something like: Replace.ChangeFrom = "Wibble |S Wobble" When the string is parsed, the |S becomes a " (and doesn't confuse the interpreter into thinking it's the end of the string). Now, |S will insert the byte value 19. Strictly speaking, this is a feature rather than a bug - because I deliberately chose to make the vertical bar followed by a letter work like that. It used to be |J for a line feed, |M for a return, and |S for a " so the new form is consistent with two thirds of those, gives a greater range (of 26 characters), and it's cheaper. However, the " is quite useful. (Note: It can still be included from the front end - it's only in scripts that this is a problem). I'll decide how to solve this problem when I next switch the development machine on - there are a couple of ways to deal with it, such as treating |S as a special case, and what I do will depend on how much time I have when I actually look at it. In the meantime, the way I dealt with the problem today was to do a manual search and replace (ie from the front end) before and after doing anything script based: Before using my script, I replaced " with !!QM!! (Within the script, I used !!QM!! wherever I wanted a ") After using my script, I replaced !!QM!! with " I was tempted to use !S instead of !!QM!! - which would allow the script to be as it was, but I couldn't remember if I'd hard coded |S in the front end, in which case it wouldn't have worked. -- Soft Rock Software: http://www.softrock.co.uk Vince M Hudd: http://misc.vinceh.com/about-vinceh/ RISCOSitory: http://www.riscository.com