# HG changeset patch # User Franz Glasner # Date 1744279116 -7200 # Node ID 7761a15b97360e1e2f8b352165dd749196167ab9 # Parent 8a8a43e8369daf3f2af870508b268e4e905410d0 treesum: Escape `\' using `\\' instead of `\x5c'. Wished by sbro. BUGS: Escaping should be controllable by a commandline option. diff -r 8a8a43e8369d -r 7761a15b9736 cutils/util/walk.py --- a/cutils/util/walk.py Thu Apr 10 01:54:09 2025 +0200 +++ b/cutils/util/walk.py Thu Apr 10 11:58:36 2025 +0200 @@ -220,12 +220,12 @@ # with it # if isinstance(what, bytes): - s = (what.replace(b'\\', b"\\x5c") + s = (what.replace(b'\\', b"\\\\") .replace(b'\n', b"\\x0a") .replace(b'\r', b"\\x0d") .replace(b'\t', b"\\x09")) else: - s = (what.replace(u'\\', u"\\x5c") + s = (what.replace(u'\\', u"\\\\") .replace(u'\n', u"\\x0a") .replace(u'\r', u"\\x0d") .replace(u'\t', u"\\x09")) @@ -329,12 +329,12 @@ # with it # if isinstance(what, bytes): - s = (what.replace(b'\\', b"\\x5c") + s = (what.replace(b'\\', b"\\\\") .replace(b'\n', b"\\x0a") .replace(b'\r', b"\\x0d") .replace(b'\t', b"\\x09")) else: - s = (what.replace(u'\\', u"\\x5c") + s = (what.replace(u'\\', u"\\\\") .replace(u'\n', u"\\x0a") .replace(u'\r', u"\\x0d") .replace(u'\t', u"\\x09"))