Make ImString to return UTF-8 encoded string

This commit is contained in:
SpaiR committed 2020-05-20 01:29:55 +03:00
1 parent fe89f8dd81
commit 834b9e62cb
1 file changed
+3 -2
@@ -1,5 +1,6 @@
package imgui;
import java.nio.charset.StandardCharsets;
import java.util.Objects;
/**
@@ -61,7 +62,7 @@ public final class ImString {
public String get() {
if (inputData.isDirty) {
inputData.isDirty = false;
text = new String(data, 0, inputData.size);
text = new String(data, 0, inputData.size, StandardCharsets.UTF_8);
}
return text;
}
@@ -79,7 +80,7 @@ public final class ImString {
final int currentLen = data == null ? 0 : data.length;
byte[] newBuff = null;
// If provided value require bigger buffer and we can resize it
// If provided value require a bigger buffer and we can resize it
if (resize && (currentLen - CARET_LEN) < valueBuff.length) {
newBuff = new byte[valueBuff.length + resizeValue + CARET_LEN];
inputData.size = valueBuff.length;