#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Sat, 07 Dec 2019 14:51:15 +0100
changeset 25080 0547e33c35ac
parent 25079 1d6bd398f6d7
child 25081 44d03bc3255a
#BUGFIX by cg class: CharacterArray changed: #withCEscapes FIX: MUST also escape backslash
CharacterArray.st
--- a/CharacterArray.st	Sat Dec 07 12:55:53 2019 +0100
+++ b/CharacterArray.st	Sat Dec 07 14:51:15 2019 +0100
@@ -9031,7 +9031,7 @@
     anyEscapeNeeded := self
                         contains:[:ch |
                             ((ch codePoint between:32 and:126) not
-                            or:[ch == $' or:[ch == $"]])
+                            or:[ch == $' or:[ch == $" or:[ch == $\]]])
                         ].
     anyEscapeNeeded ifFalse:[ ^ self ].
 
@@ -9042,7 +9042,7 @@
     self do:[:ch |
         |cp|
 
-        (ch == $' or:[ch == $"]) ifTrue:[
+        (ch == $' or:[ch == $" or:[ch == $\]]) ifTrue:[
             out nextPut:$\.
             out nextPut:ch.
         ] ifFalse:[
@@ -9078,7 +9078,8 @@
     ^ out contents
 
     "
-     'hello\n\tworld' withoutCEscapes.
+     'c:\foo\bar\baz' withCEscapes.  
+     c'hello\n\tworld' withCEscapes.
      'hello\b\tworld' withoutCEscapes withCEscapes.
      'hello\nworld\na\n\tnice\n\t\tstring' withoutCEscapes withCEscapes.
      ('hello ',(Character value:16r1234),' world') withCEscapes