blob: 23d4883fd476475b30495f3eb5fb6365fa3147df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/sys_string_conversions.h"
#include "base/string_piece.h"
#include "base/string_util.h"
namespace base {
std::string SysWideToUTF8(const std::wstring& wide) {
// In theory this should be using the system-provided conversion rather
// than our ICU, but this will do for now.
return WideToUTF8(wide);
}
std::wstring SysUTF8ToWide(const StringPiece& utf8) {
// In theory this should be using the system-provided conversion rather
// than our ICU, but this will do for now.
std::wstring out;
UTF8ToWide(utf8.data(), utf8.size(), &out);
return out;
}
std::string SysWideToNativeMB(const std::wstring& wide) {
// TODO(evanm): we can't assume Linux is UTF-8.
return SysWideToUTF8(wide);
}
std::wstring SysNativeMBToWide(const StringPiece& native_mb) {
// TODO(evanm): we can't assume Linux is UTF-8.
return SysUTF8ToWide(native_mb);
}
} // namespace base
|