From 8f6d2253a0885372581f2e889a824d0cf2516bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Mon, 9 Sep 2002 06:17:05 +0000 Subject: Fix escaping of non-ASCII characters. --- Objects/stringobject.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Objects/stringobject.c') diff --git a/Objects/stringobject.c b/Objects/stringobject.c index dd38ee3c85..c090e9b2d6 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -541,6 +541,7 @@ PyObject *PyString_DecodeEscape(const char *s, end = s + len; while (s < end) { if (*s != '\\') { + non_esc: #ifdef Py_USING_UNICODE if (recode_encoding && (*s & 0x80)) { PyObject *u, *w; @@ -656,8 +657,9 @@ PyObject *PyString_DecodeEscape(const char *s, #endif default: *p++ = '\\'; - *p++ = s[-1]; - break; + s--; + goto non_esc; /* an arbitry number of unescaped + UTF-8 bytes may follow. */ } } if (p-buf < newlen) -- cgit v1.2.1