Use alloc_c_string() to convert String to char*

Using get_data() would sometimes result in the wrong data being written.

Fixes #12
This commit is contained in:
Leroy Hopson 2020-11-07 17:12:31 +07:00 committed by Leroy Hopson
parent 43df7d5331
commit 399acf00c7
2 changed files with 5 additions and 3 deletions

View file

@ -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: