diff options
author | adriansc@chromium.org <adriansc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-19 22:26:51 +0000 |
---|---|---|
committer | adriansc@chromium.org <adriansc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-19 22:26:51 +0000 |
commit | 775870c1189d662e271f7336b161455dc6146273 (patch) | |
tree | 3fdcb666b24dc8605aa7362dae6b283321ee1259 /webkit/support | |
parent | 680ce4c996a3659cd37283213eadfec3d41b5574 (diff) | |
download | chromium_src-775870c1189d662e271f7336b161455dc6146273.zip chromium_src-775870c1189d662e271f7336b161455dc6146273.tar.gz chromium_src-775870c1189d662e271f7336b161455dc6146273.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
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=101213
Review URL: http://codereview.chromium.org/7744017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r-- | webkit/support/platform_support_mac.mm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm index b65ad50a..db62c2d 100644 --- a/webkit/support/platform_support_mac.mm +++ b/webkit/support/platform_support_mac.mm @@ -14,6 +14,7 @@ #include "base/mac/mac_util.h" #include "base/path_service.h" #include "base/string16.h" +#include "base/utf_string_conversions.h" #include "grit/webkit_resources.h" #include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.h" #include "ui/base/resource/data_pack.h" @@ -162,8 +163,23 @@ string16 GetLocalizedString(int message_id) { if (!g_resource_data_pack->GetStringPiece(message_id, &res)) { LOG(FATAL) << "failed to load webkit string with id " << message_id; } - return string16(reinterpret_cast<const char16*>(res.data()), - res.length() / 2); + + // Data packs hold strings as either UTF8 or UTF16. + string16 msg; + switch (g_resource_data_pack->GetTextEncodingType()) { + case ui::DataPack::UTF8: + msg = UTF8ToUTF16(res); + break; + case ui::DataPack::UTF16: + msg = string16(reinterpret_cast<const char16*>(res.data()), + res.length() / 2); + break; + case ui::DataPack::BINARY: + default: + break; + } + + return msg; } // Helper method for getting the path to the test shell resources directory. |