summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/string_util.h')
-rw-r--r--base/string_util.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/base/string_util.h b/base/string_util.h
index d47d5f2..129f124 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -155,21 +155,17 @@ std::wstring CollapseWhitespace(const std::wstring& text,
std::string WideToASCII(const std::wstring& wide);
std::wstring ASCIIToWide(const std::string& ascii);
-// These convert between UTF8 and UTF16 strings. They are potentially slow,
-// so avoid unnecessary conversions. Most things should be in UTF16.
+// These convert between UTF8 and UTF16 strings. They are potentially slow, so
+// avoid unnecessary conversions. Most things should be in wide. The low-level
+// versions return a boolean indicating whether the conversion was 100% valid.
+// In this case, it will still do the best it can and put the result in the
+// output buffer. The versions that return strings ignore this error and just
+// return the best conversion possible.
+bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output);
std::string WideToUTF8(const std::wstring& wide);
+bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output);
std::wstring UTF8ToWide(const std::string& utf8);
-// Converts between wide strings and whatever the native multibyte encoding
-// is. The native multibyte encoding on English machines will often Latin-1,
-// but could be ShiftJIS or even UTF-8, among others.
-//
-// These functions can be dangerous. Do not use unless you are sure you are
-// giving them to/getting them from somebody who expects the current platform
-// 8-bit encoding.
-std::string WideToNativeMB(const std::wstring& wide);
-std::wstring NativeMBToWide(const std::string& native_mb);
-
// Defines the error handling modes of WideToCodepage and CodepageToWide.
class OnStringUtilConversionError {
public: