summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/prebuild/create_string_rc.py
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 04:17:36 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-06 04:17:36 +0000
commit97a28ef93ae420282c3d877d18b2d363abe26ed4 (patch)
treefb89ee553a4d963401db1b3577ddb9d523462958 /chrome/installer/util/prebuild/create_string_rc.py
parent2ae64d648884a2c469ab987fb8ddbaa981ca3fe9 (diff)
downloadchromium_src-97a28ef93ae420282c3d877d18b2d363abe26ed4.zip
chromium_src-97a28ef93ae420282c3d877d18b2d363abe26ed4.tar.gz
chromium_src-97a28ef93ae420282c3d877d18b2d363abe26ed4.tar.bz2
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
Diffstat (limited to 'chrome/installer/util/prebuild/create_string_rc.py')
-rwxr-xr-xchrome/installer/util/prebuild/create_string_rc.py6
1 files changed, 5 insertions, 1 deletions
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'))