Skip to content

Commit b95ea79

Browse files
committed
handle end of </strings> element whitespace characters
1 parent bc84f7f commit b95ea79

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

openformats/formats/android.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ def content(self):
5454
return self.text
5555
if self.content_end is None:
5656
return None
57-
result = self.source[self.text_position:self.content_end]
58-
if result.endswith("]]>"):
59-
result = self.source[self.text_position:self.content_end-len("]]>")]
60-
return result
57+
_string_value = self.source[self.text_position:self.content_end]
58+
if _string_value.strip().endswith("]]>"):
59+
diff = len(_string_value) -len(_string_value.strip())
60+
self._content_end = self.content_end-diff if diff>0 else self.content_end
61+
_string_value = self.source[self.text_position:self.content_end-len("]]>")]
62+
return _string_value
6163

6264

6365
class AndroidHandler(Handler):

0 commit comments

Comments
 (0)