Chris Hopman ccdc57dd96 Fix handling of bad utf16 passed out of JS
Summary:
JSC's utf16 -> utf8 conversion crashes on encountering bad utf16. Instead, use our own conversion (conveniently copied from fbjni).

Original fix thanks to rigdern (https://github.com/facebook/react-native/pull/9302)

Reviewed By: mhorowitz

Differential Revision: D3746947

fbshipit-source-id: 29887ca720f6a2b074f01f853bad28a083b273bc
2016-08-23 17:13:38 -07:00

15 lines
247 B
C++

// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#include <string>
#include <cstdint>
namespace facebook {
namespace react {
namespace unicode {
std::string utf16toUTF8(const uint16_t* utf16, size_t length) noexcept;
}
}
}