OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "net/base/escape.h" | |
6 | |
7 #include "base/i18n/icu_string_conversions.h" | |
8 #include "base/utf_string_conversions.h" | |
9 | |
10 // This file exists to avoid having escape.cc depend on ICU. | |
11 | |
12 namespace net { | |
13 | |
14 bool EscapeQueryParamValue(const string16& text, | |
15 const char* codepage, | |
16 bool use_plus, | |
17 string16* escaped) { | |
18 // TODO(brettw) bug 1201094: this function should be removed, this "SKIP" | |
19 // behavior is wrong when the character can't be encoded properly. | |
20 std::string encoded; | |
21 if (!base::UTF16ToCodepage(text, codepage, | |
22 base::OnStringConversionError::SKIP, &encoded)) | |
23 return false; | |
24 | |
25 escaped->assign(UTF8ToUTF16(EscapeQueryParamValue(encoded, use_plus))); | |
26 return true; | |
27 } | |
28 | |
29 } // namespace net | |
OLD | NEW |