[gjs/gnome-3-28] Fix UTF8 encoding for some GJS string arrays. - The function that constructs string arrays for impor
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/gnome-3-28] Fix UTF8 encoding for some GJS string arrays. - The function that constructs string arrays for impor
- Date: Mon, 1 Oct 2018 07:02:11 +0000 (UTC)
commit 98e7edaa2ecd9aea43c5bc18bbdc508f90925942
Author: rockon999 <rockon999 users noreply github com>
Date: Mon Mar 26 19:59:18 2018 -0400
Fix UTF8 encoding for some GJS string arrays.
- The function that constructs string arrays for imports and argv utilized a JS_NewStringCopyZ call
instead of the proper JS_NewStringCopyUTF8Z (the input is UTF8).
gjs/jsapi-util.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gjs/jsapi-util.cpp b/gjs/jsapi-util.cpp
index 322a41b2..5c91dd2a 100644
--- a/gjs/jsapi-util.cpp
+++ b/gjs/jsapi-util.cpp
@@ -313,8 +313,9 @@ gjs_build_string_array(JSContext *context,
g_error("Unable to reserve memory for vector");
for (i = 0; i < array_length; ++i) {
+ JS::ConstUTF8CharsZ chars(array_values[i], strlen(array_values[i]));
JS::RootedValue element(context,
- JS::StringValue(JS_NewStringCopyZ(context, array_values[i])));
+ JS::StringValue(JS_NewStringCopyUTF8Z(context, chars)));
if (!elems.append(element))
g_error("Unable to append to vector");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]