From: Daniel Martí Date: Thu, 4 Jun 2015 13:56:20 +0000 (+0200) Subject: Properly support escaped strings X-Git-Tag: 0.4.0~43 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=d0b5e6036979b7e4a5219ea862f01db69d0f7916;p=fdroidserver.git Properly support escaped strings See: https://developer.android.com/guide/topics/resources/string-resource.html --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 33c89ea2..c2eb4388 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -859,6 +859,13 @@ class vcs_bzr(vcs): p.output.splitlines()] +def unescape_string(string): + if string[0] == '"' and string[-1] == '"': + return string[1:-1] + + return string.replace("\\'", "'") + + def retrieve_string(app_dir, string, xmlfiles=None): if xmlfiles is None: @@ -872,7 +879,7 @@ def retrieve_string(app_dir, string, xmlfiles=None): xmlfiles += [os.path.join(r, x) for x in f if x.endswith('.xml')] if not string.startswith('@string/'): - return string.replace("\\'", "'") + return unescape_string(string) name = string[len('@string/'):]