godot-cpp icon indicating copy to clipboard operation
godot-cpp copied to clipboard

`String::append_utf*` functions missing.

Open Rubonnek opened this issue 5 months ago • 1 comments

Godot version

4d1f26e1fd1fa46f2223fe0b6ac300744bf79b88

godot-cpp version

master branch at 6a870949a5d38c62638af23dc13210f77154aa2c

System information

Arch Linux

Issue description

Attempting to use any of the String::append_utf* functions will generate a compiler error:

error: 'class godot::String' has no member named 'append_utf8'

These functions are equivalent to String::parse_utf* -- they were renamed in https://github.com/godotengine/godot/commit/ffa6ef220bdefe64b0d2ebb3c48c5dc54d52045b.

Steps to reproduce

Attempt to use any of the String::append_utf*, compile, compiler error ensues.

Minimal reproduction project

String test_string = "testing";
test_string.append_utf8("compiler_error_here");

Rubonnek avatar Jul 09 '25 02:07 Rubonnek

I recommend the new bindings are added via the regular bindings API in 'low-level' mode which I proposed. It would be a good fit.

Sort of off topic, but taking a look at godot-cpp's parse_utf8, I think it may be sort of broken anyhow. It's calling gdextension_interface_string_new_with_utf8_chars_and_len2, which is constructing String in place:

https://github.com/godotengine/godot/blob/c6d130abd9188f313e6701d01a0ddd6ea32166a0/core/extension/gdextension_interface.cpp#L916-L917

I think this leaks the underlying String's memory.

The correct implementation of parse_utfx (in case we want to keep backwards compat) is now clear(); append_utf8, which needs new bindings.

Ivorforce avatar Jul 13 '25 17:07 Ivorforce