From 6b7a7b7b1218d3b8269c6f5e655a8003a71cee64 Mon Sep 17 00:00:00 2001 From: TeamSpen210 Date: Wed, 23 Dec 2015 15:46:59 +1000 Subject: [PATCH] Handle bytes in multiline values\ --- src/property_parser.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/property_parser.py b/src/property_parser.py index 58a875d1d..577003b5a 100644 --- a/src/property_parser.py +++ b/src/property_parser.py @@ -85,6 +85,9 @@ def read_multiline_value(file, line_num, filename): lines = [''] # We return with a beginning newline # Re-looping over the same iterator means we don't repeat lines for line_num, line in file: + if isinstance(line, bytes): + # Decode bytes using utf-8 + line = line.decode('utf-8') line = line.strip() if line.endswith('"'): lines.append(line[:-1]) @@ -614,6 +617,7 @@ def export(self): for prop in self.value: yield from prop.export() else: + yield '"' + self.real_name + '"\n' yield '\t{\n' yield from ( '\t' + line