1 // Copyright 2019 The V8 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 // This file is V8 specific. It's not rolled from the upstream project. 6 7 #include "test_platform.h" 8 9 #include "src/inspector/v8-string-conversions.h" 10 11 namespace v8_crdtp { 12 UTF16ToUTF8(span<uint16_t> in)13std::string UTF16ToUTF8(span<uint16_t> in) { 14 return v8_inspector::UTF16ToUTF8(in.data(), in.size()); 15 } 16 UTF8ToUTF16(span<uint8_t> in)17std::vector<uint16_t> UTF8ToUTF16(span<uint8_t> in) { 18 std::basic_string<uint16_t> utf16 = v8_inspector::UTF8ToUTF16( 19 reinterpret_cast<const char*>(in.data()), in.size()); 20 return std::vector<uint16_t>(utf16.begin(), utf16.end()); 21 } 22 23 } // namespace v8_crdtp 24