diff --git a/include/godot_cpp/classes/wrapped.hpp b/include/godot_cpp/classes/wrapped.hpp index 0ffd783f3b..254eb0a175 100644 --- a/include/godot_cpp/classes/wrapped.hpp +++ b/include/godot_cpp/classes/wrapped.hpp @@ -250,7 +250,7 @@ public: } \ \ static const ::godot::StringName &get_class_static() { \ - static const ::godot::StringName string_name = ::godot::StringName(#m_class); \ + static const ::godot::StringName string_name = ::godot::StringName(L## #m_class); \ return string_name; \ } \ \ diff --git a/test/project/main.gd b/test/project/main.gd index b2625b9a05..b2d5b6a4be 100644 --- a/test/project/main.gd +++ b/test/project/main.gd @@ -276,6 +276,10 @@ func _ready(): assert_equal(library_path, ProjectSettings.globalize_path(library_path)) assert_equal(FileAccess.file_exists(library_path), true) + # Test a class with a unicode name. + var przykład = ExamplePrzykład.new() + assert_equal(przykład.get_the_word(), "słowo to przykład") + exit_with_status() func _on_Example_custom_signal(signal_name, value): diff --git a/test/src/example.cpp b/test/src/example.cpp index 8075f551d3..396f79fd92 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -736,3 +736,11 @@ ExampleRuntime::ExampleRuntime() { ExampleRuntime::~ExampleRuntime() { } + +void ExamplePrzykład::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_the_word"), &ExamplePrzykład::get_the_word); +} + +String ExamplePrzykład::get_the_word() const { + return L"słowo to przykład"; +} diff --git a/test/src/example.h b/test/src/example.h index 6d88cf1116..6d31ca59ba 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -273,4 +273,14 @@ class ExampleRuntime : public Node { ~ExampleRuntime(); }; +class ExamplePrzykład : public RefCounted { + GDCLASS(ExamplePrzykład, RefCounted); + +protected: + static void _bind_methods(); + +public: + String get_the_word() const; +}; + #endif // EXAMPLE_CLASS_H diff --git a/test/src/register_types.cpp b/test/src/register_types.cpp index 7cfe689e0e..d9290c805b 100644 --- a/test/src/register_types.cpp +++ b/test/src/register_types.cpp @@ -30,6 +30,7 @@ void initialize_example_module(ModuleInitializationLevel p_level) { GDREGISTER_CLASS(ExampleBase); GDREGISTER_CLASS(ExampleChild); GDREGISTER_RUNTIME_CLASS(ExampleRuntime); + GDREGISTER_CLASS(ExamplePrzykład); } void uninitialize_example_module(ModuleInitializationLevel p_level) {