Ian Bicking wrote:
On Sat, 2003-01-25 at 16:19, Stuart Donaldson wrote:
  
In essence, Fazal Majid's patch which he included in the bug report is:
  		#self.chars = string.replace(self.chars,'\t','\\\\t')
  		#self.chars = string.replace(self.chars, "'",
"\\'")
  		self.chars = string.replace(self.chars,'"',r'\"')
+ 		self.chars = string.replace(self.chars,r'\n',r'\\n')
+ 		self.chars = string.replace(self.chars,r'\t',r'\\t')
+ 		self.chars = string.replace(self.chars,r'\r',r'\\r')
    

This is weird.  The proper string.replace statements were commented out
(except for \r, which was probably just an oversight).  The proper patch
would be to uncomment these lines.

But that they were commented out surprises me.

In fact, what should really happen is
    string.replace(r'\', r'\\')
    string.replace(r'"', r'\"')

  Ian

  
They were commented out since the beginning in CVS anyway.

Well, I had thought something similar to your suggestion.  Altough the syntax r'\' does not work as even a raw string can't end in a single backslash.

I have tried

    string.replace( self.chars, '\\', r'\\' )
    string.replace( self.chars, '*', r'\"' )

This seems to work, as the first replace just takes any backslash and replaces it with a double-backslash. This should mean that in the compiled PSP, the only backslash processing will be the double-backslashes resolving down to a single as found in the original text, and then any quotes will also have a backslash in front.

This at least provides functionality where the existing system is broken.  The concern is, do we break anything else?

-Stuart-