summaryrefslogtreecommitdiffstats
path: root/chrome_frame/simple_resource_loader.cc
diff options
context:
space:
mode:
authoradriansc@chromium.org <adriansc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:15:45 +0000
committeradriansc@chromium.org <adriansc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 01:15:45 +0000
commit2c7e28115d1334537dbf984ad6bf2bebf46c8739 (patch)
treecc4adfe3f7bc75400ea75cd5d6c8ce02dc669391 /chrome_frame/simple_resource_loader.cc
parentdeef80c3e13afea9a86f56103a7721e6a08b2775 (diff)
downloadchromium_src-2c7e28115d1334537dbf984ad6bf2bebf46c8739.zip
chromium_src-2c7e28115d1334537dbf984ad6bf2bebf46c8739.tar.gz
chromium_src-2c7e28115d1334537dbf984ad6bf2bebf46c8739.tar.bz2
Updated *.pak file format to support both UTF8 and UTF16
Inserted a new field in the header that specifies which encoding is to be used for the text resources. I also upped file format to version 4. BUG=76281 TEST=unit_tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=100973 Review URL: http://codereview.chromium.org/7744017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101213 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/simple_resource_loader.cc')
-rw-r--r--chrome_frame/simple_resource_loader.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome_frame/simple_resource_loader.cc b/chrome_frame/simple_resource_loader.cc
index 2d1e80a..a28a62c 100644
--- a/chrome_frame/simple_resource_loader.cc
+++ b/chrome_frame/simple_resource_loader.cc
@@ -241,10 +241,14 @@ std::wstring SimpleResourceLoader::GetLocalizedResource(int message_id) {
return std::wstring();
}
- // Data pack encodes strings as UTF16.
- DCHECK_EQ(data.length() % 2, 0U);
- string16 msg(reinterpret_cast<const char16*>(data.data()),
- data.length() / 2);
+ // Data pack encodes strings as either UTF8 or UTF16.
+ string16 msg;
+ if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF16) {
+ msg = string16(reinterpret_cast<const char16*>(data.data()),
+ data.length() / 2);
+ } else if (data_pack_->GetTextEncodingType() == ui::DataPack::UTF8) {
+ msg = UTF8ToUTF16(data);
+ }
return msg;
}