From 97a28ef93ae420282c3d877d18b2d363abe26ed4 Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Thu, 6 May 2010 04:17:36 +0000 Subject: Escape special characters in installer strings (rc file). Review URL: http://codereview.chromium.org/1980006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46549 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/installer/util/prebuild/create_string_rc.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'chrome/installer') diff --git a/chrome/installer/util/prebuild/create_string_rc.py b/chrome/installer/util/prebuild/create_string_rc.py index 4c575f5..ba43095 100755 --- a/chrome/installer/util/prebuild/create_string_rc.py +++ b/chrome/installer/util/prebuild/create_string_rc.py @@ -157,8 +157,12 @@ def WriteRCFile(translated_strings, out_filename): ) lines = [kHeaderText] for translation_struct in translated_strings: + # Escape special characters for the rc file. + translation = (translation_struct.translation.replace('"', '""') + .replace('\t', '\\t') + .replace('\n', '\\n')) lines.append(u' %s "%s"\n' % (translation_struct.resource_id_str, - translation_struct.translation)) + translation)) lines.append(kFooterText) outfile = open(out_filename + '.rc', 'wb') outfile.write(''.join(lines).encode('utf-16')) -- cgit v1.1