diff options
Diffstat (limited to 'pathod')
-rw-r--r-- | pathod/language/base.py | 8 | ||||
-rw-r--r-- | pathod/pathoc.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/pathod/language/base.py b/pathod/language/base.py index 25f3fd1a..39155858 100644 --- a/pathod/language/base.py +++ b/pathod/language/base.py @@ -136,7 +136,7 @@ class TokValueLiteral(_TokValueLiteral): def spec(self): inner = strutils.bytes_to_escaped_str(self.val) - inner = inner.replace(r"\'", r"\x27") + inner = inner.replace(r"'", r"\x27") return "'" + inner + "'" @@ -148,7 +148,7 @@ class TokValueNakedLiteral(_TokValueLiteral): return e.setParseAction(lambda x: cls(*x)) def spec(self): - return strutils.bytes_to_escaped_str(self.val) + return strutils.bytes_to_escaped_str(self.val, escape_single_quotes=True) class TokValueGenerate(Token): @@ -166,7 +166,7 @@ class TokValueGenerate(Token): def freeze(self, settings): g = self.get_generator(settings) - return TokValueLiteral(strutils.bytes_to_escaped_str(g[:])) + return TokValueLiteral(strutils.bytes_to_escaped_str(g[:], escape_single_quotes=True)) @classmethod def expr(cls): @@ -578,4 +578,4 @@ class NestedMessage(Token): def freeze(self, settings): f = self.parsed.freeze(settings).spec() - return self.__class__(TokValueLiteral(strutils.bytes_to_escaped_str(f.encode()))) + return self.__class__(TokValueLiteral(strutils.bytes_to_escaped_str(f.encode(), escape_single_quotes=True))) diff --git a/pathod/pathoc.py b/pathod/pathoc.py index c6783878..5831ba3e 100644 --- a/pathod/pathoc.py +++ b/pathod/pathoc.py @@ -444,7 +444,7 @@ class Pathoc(tcp.TCPClient): finally: if resp: lg("<< %s %s: %s bytes" % ( - resp.status_code, strutils.bytes_to_escaped_str(resp.reason.encode()), len(resp.content) + resp.status_code, strutils.escape_control_characters(resp.reason) if resp.reason else "", len(resp.content) )) if resp.status_code in self.ignorecodes: lg.suppress() |