@@ -343,7 +343,7 @@ JSValue QuickJSBinder::godot_builtin_function(JSContext *ctx, JSValue this_val,
343
343
int arg_required = Expression::get_func_argument_count(func);
344
344
if (argc < arg_required) {
345
345
String func_name = Expression::get_func_name(func);
346
- return JS_ThrowTypeError(ctx, "%d arguments expected for builtin funtion %s", arg_required, func_name.ascii ().get_data());
346
+ return JS_ThrowTypeError(ctx, "%d arguments expected for builtin funtion %s", arg_required, func_name.utf8 ().get_data());
347
347
}
348
348
349
349
QuickJSBinder *binder = get_context_binder(ctx);
@@ -378,7 +378,7 @@ JSValue QuickJSBinder::godot_builtin_function(JSContext *ctx, JSValue this_val,
378
378
379
379
if (err.error != Variant::CallError::CALL_OK) {
380
380
String func_name = Expression::get_func_name(func);
381
- return JS_ThrowTypeError(ctx, "Call builtin function error %s: %s", func_name.ascii ().get_data(), err_msg.utf8().get_data());
381
+ return JS_ThrowTypeError(ctx, "Call builtin function error %s: %s", func_name.utf8 ().get_data(), err_msg.utf8().get_data());
382
382
}
383
383
384
384
#endif
@@ -509,14 +509,14 @@ Dictionary QuickJSBinder::js_to_dictionary(JSContext *ctx, const JSValue &p_val,
509
509
510
510
JSAtom QuickJSBinder::get_atom (JSContext *ctx, const StringName &p_key) {
511
511
String name = p_key;
512
- CharString name_str = name.ascii ();
512
+ CharString name_str = name.utf8 ();
513
513
JSAtom atom = JS_NewAtom (ctx, name_str.get_data ());
514
514
return atom;
515
515
}
516
516
517
517
JSValue QuickJSBinder::godot_to_string (JSContext *ctx, JSValue this_val, int argc, JSValue *argv) {
518
518
String str = var_to_variant (ctx, this_val);
519
- CharString ascii = str.ascii ();
519
+ CharString ascii = str.utf8 ();
520
520
return JS_NewStringLen (ctx, ascii.get_data (), ascii.length ());
521
521
}
522
522
@@ -830,7 +830,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
830
830
return 0 ;
831
831
}
832
832
} else {
833
- data.class_name = String (p_cls->name ).ascii ();
833
+ data.class_name = String (p_cls->name ).utf8 ();
834
834
data.jsclass .class_name = data.class_name .get_data ();
835
835
}
836
836
@@ -857,7 +857,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
857
857
858
858
MethodBind *mb = pair.value ;
859
859
godot_methods.set (internal_godot_method_id, mb);
860
- CharString name = String (pair.key ).ascii ();
860
+ CharString name = String (pair.key ).utf8 ();
861
861
JSValue method = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_method, name.get_data (), mb->get_argument_count (), JS_CFUNC_generic_magic, internal_godot_method_id);
862
862
JS_DefinePropertyValueStr (ctx, data.prototype , name.get_data (), method, PROP_DEF_DEFAULT);
863
863
methods.insert (pair.key , method);
@@ -890,7 +890,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
890
890
godot_object_indexed_properties.resize (size + 128 );
891
891
}
892
892
godot_object_indexed_properties.write [internal_godot_indexed_property_id] = ∝
893
- CharString name = String (prop_name).ascii ();
893
+ CharString name = String (prop_name).utf8 ();
894
894
getter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_indexed_property, name.get_data (), 0 , JS_CFUNC_generic_magic, internal_godot_indexed_property_id);
895
895
setter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_indexed_property, name.get_data (), 1 , JS_CFUNC_generic_magic, internal_godot_indexed_property_id);
896
896
++internal_godot_indexed_property_id;
@@ -904,7 +904,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
904
904
}
905
905
godot_methods.write [internal_godot_method_id] = mb;
906
906
String setter_name = prop.setter ;
907
- setter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_method, setter_name.ascii ().get_data (), mb->get_argument_count (), JS_CFUNC_generic_magic, internal_godot_method_id);
907
+ setter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_method, setter_name.utf8 ().get_data (), mb->get_argument_count (), JS_CFUNC_generic_magic, internal_godot_method_id);
908
908
++internal_godot_method_id;
909
909
}
910
910
@@ -917,7 +917,7 @@ JSClassID QuickJSBinder::register_class(const ClassDB::ClassInfo *p_cls) {
917
917
}
918
918
godot_methods.write [internal_godot_method_id] = mb;
919
919
String getter_name = prop.getter ;
920
- getter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_method, getter_name.ascii ().get_data (), mb->get_argument_count (), JS_CFUNC_generic_magic, internal_godot_method_id);
920
+ getter = JS_NewCFunctionMagic (ctx, &QuickJSBinder::object_method, getter_name.utf8 ().get_data (), mb->get_argument_count (), JS_CFUNC_generic_magic, internal_godot_method_id);
921
921
++internal_godot_method_id;
922
922
}
923
923
}
@@ -1153,7 +1153,7 @@ void QuickJSBinder::add_godot_globals() {
1153
1153
for (int i = 0; i < Expression::FUNC_MAX; ++i) {
1154
1154
Expression::BuiltinFunc func = (Expression::BuiltinFunc)i;
1155
1155
String name = Expression::get_func_name(func);
1156
- JSValue js_func = JS_NewCFunctionMagic(ctx, godot_builtin_function, name.ascii ().get_data(), 0, JS_CFUNC_generic_magic, i);
1156
+ JSValue js_func = JS_NewCFunctionMagic(ctx, godot_builtin_function, name.utf8 ().get_data(), 0, JS_CFUNC_generic_magic, i);
1157
1157
JSAtom atom = get_atom(ctx, name);
1158
1158
JS_DefinePropertyValue(ctx, godot_object, atom, js_func, QuickJSBinder::PROP_DEF_DEFAULT);
1159
1159
JS_FreeAtom(ctx, atom);
0 commit comments