diff --git a/lib/utils/text.py b/lib/utils/text.py index 7ec049e951a21b7717bcec91d5b3aa680fc5025d..f369c74f487cbeff0ab44ed671c66b7ea816986d 100644 --- a/lib/utils/text.py +++ b/lib/utils/text.py @@ -383,10 +383,12 @@ def UnescapeAndSplit(text, sep=","): num_b = len(e1) - len(e1.rstrip("\\")) if num_b % 2 == 1 and slist: e2 = slist.pop(0) - # here the backslashes remain (all), and will be reduced in - # the next step - rlist.append(e1 + sep + e2) + # Merge the two elements and push the result back to the source list for + # revisiting. If e2 ended with backslashes, further merging may need to + # be done. + slist.insert(0, e1 + sep + e2) continue + # here the backslashes remain (all), and will be reduced in the next step rlist.append(e1) # finally, replace backslash-something with something rlist = [re.sub(r"\\(.)", r"\1", v) for v in rlist]