From fed45174eded9edd9de2374c13d63b5814c4bae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Szabo?= Date: Thu, 19 Feb 2026 10:36:42 -0300 Subject: [PATCH] Fix API for Electron 40. --- src/binding.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/binding.cpp b/src/binding.cpp index 5bf7e56..e1a8741 100644 --- a/src/binding.cpp +++ b/src/binding.cpp @@ -36,8 +36,14 @@ T get_property(const v8::Local &object, const char *name) std::string to_std_string(const v8::Local &v8str) { v8::Isolate *isolate = v8::Isolate::GetCurrent(); +#if V8_MAJOR_VERSION > 13 || (V8_MAJOR_VERSION == 13 && V8_MINOR_VERSION >= 2) + size_t len = v8str->Utf8LengthV2(isolate); + std::string str(len, ' '); + v8str->WriteUtf8V2(isolate, &str[0], len); +#else std::string str(v8str->Utf8Length(isolate), ' '); v8str->WriteUtf8(isolate, &str[0]); +#endif return str; }