diff --git a/src/preserves.nim b/src/preserves.nim index 0d69621..a7db9ab 100644 --- a/src/preserves.nim +++ b/src/preserves.nim @@ -1315,7 +1315,7 @@ proc writeText*[E](stream: Stream; pr: Preserve[E]) = write(stream, '"') of pkSymbol: let sym = pr.symbol.string - if sym.len > 0 and sym.allIt(char(it) in {'0'..'9', 'A'..'z'}) and sym[0] notin {'0'..'9'}: + if sym.len > 0 and sym[0] in {'A'..'z'} and not sym.anyIt(char(it) in { '\x00'..'\x19', '"', '\\', '|' }): write(stream, sym) else: write(stream, '|') @@ -1325,15 +1325,15 @@ proc writeText*[E](stream: Stream; pr: Preserve[E]) = write(stream, "\\\\") of '/': write(stream, "\\/") - of '\x62': + of '\x08': write(stream, "\\b") - of '\x66': + of '\x0c': write(stream, "\\f") - of '\x6e': + of '\x0a': write(stream, "\\n") - of '\x72': + of '\x0d': write(stream, "\\r") - of '\x74': + of '\x09': write(stream, "\\t") of '|': write(stream, "\\|")