diff --git a/CHANGELOG.md b/CHANGELOG.md index 8917ffe..bb80fe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Positioned background rect at 0,0 so it is no longer offset if a margin is added when Terminal is a child of a Container node. - Removed all pre-compiled binaries using BFG [Repo-Cleaner](https://rtyley.github.io/bfg-repo-cleaner/), thus re-writing git history. +### Fixed +- Fixed #12 where incorrect data would sometimes be written to the terminal when passing a string to the Terminal's `write()` method. + ## [1.0.0] - 2020-10-05 ### Added - Changelog. diff --git a/addons/godot_xterm/native/src/terminal.cpp b/addons/godot_xterm/native/src/terminal.cpp index 58815e0..2981089 100644 --- a/addons/godot_xterm/native/src/terminal.cpp +++ b/addons/godot_xterm/native/src/terminal.cpp @@ -585,9 +585,8 @@ void Terminal::write(Variant data) case Variant::Type::STRING: { String string = data; - CharString utf8 = string.utf8(); - u8 = utf8.get_data(); - len = utf8.length(); + u8 = string.alloc_c_string(); + len = strlen(u8); break; } default: