From 834b9e62cbb6ce1efb03b801436be82d47372a1f Mon Sep 17 00:00:00 2001 From: SpaiR Date: Wed, 20 May 2020 01:28:55 +0300 Subject: [PATCH] Make ImString to return UTF-8 encoded string --- imgui-binding/src/main/java/imgui/ImString.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/imgui-binding/src/main/java/imgui/ImString.java b/imgui-binding/src/main/java/imgui/ImString.java index b38e31a..8b26fee 100644 --- a/imgui-binding/src/main/java/imgui/ImString.java +++ b/imgui-binding/src/main/java/imgui/ImString.java @@ -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;