summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 23:47:42 +0000
committerpaulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-20 23:47:42 +0000
commit4de93aa65da7067c8d253f073435e8d8ae5b1da9 (patch)
tree0dea5f32415dbc3bcb41f2371fe2db4cd6e5d0d5 /net
parent1f6f84dc23818a0b042b5f01ed229eaefa8514ff (diff)
downloadchromium_src-4de93aa65da7067c8d253f073435e8d8ae5b1da9.zip
chromium_src-4de93aa65da7067c8d253f073435e8d8ae5b1da9.tar.gz
chromium_src-4de93aa65da7067c8d253f073435e8d8ae5b1da9.tar.bz2
Final character conversions for net_util.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/net_util.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index a12b4d8..e0cbd04 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -620,11 +620,24 @@ void IDNToUnicodeOneComponent(const wchar_t* comp,
}
while (true) {
- out->resize(out->size() + extra_space);
UErrorCode status = U_ZERO_ERROR;
- int output_chars = uidna_IDNToUnicode(
- comp, comp_len, &(*out)[host_begin_in_output], extra_space,
- UIDNA_DEFAULT, NULL, &status);
+#if defined(WCHAR_T_IS_UTF32)
+ std::string16 comp16;
+ WideToUTF16(comp, comp_len, &comp16);
+ std::string16 out16;
+ WideToUTF16(out->c_str(), out->length(), &out16);
+ out16.resize(out16.size() + extra_space);
+ int output_chars =
+ uidna_IDNToUnicode(comp16.data(), static_cast<int32>(comp16.length()),
+ &(out16)[host_begin_in_output], extra_space,
+ UIDNA_DEFAULT, NULL, &status);
+ *out = UTF16ToWide(out16);
+#else
+ out->resize(out->size() + extra_space);
+ int output_chars =
+ uidna_IDNToUnicode(comp, comp_len, &(*out)[host_begin_in_output],
+ extra_space, UIDNA_DEFAULT, NULL, &status);
+#endif
if (status == U_ZERO_ERROR) {
// Converted successfully.
out->resize(host_begin_in_output + output_chars);