#BUGFIX by cg
class: CharacterArray
changed: #withCEscapes
FIX: MUST also escape backslash
--- 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