summaryrefslogtreecommitdiff
path: root/rtl/java
diff options
context:
space:
mode:
Diffstat (limited to 'rtl/java')
-rw-r--r--rtl/java/justrings.inc9
1 files changed, 3 insertions, 6 deletions
diff --git a/rtl/java/justrings.inc b/rtl/java/justrings.inc
index e3f3ff1c4a..bc40e03e54 100644
--- a/rtl/java/justrings.inc
+++ b/rtl/java/justrings.inc
@@ -794,18 +794,15 @@ function UTF8Encode(const s : UnicodeString) : RawByteString;
function UTF8Decode(const s : RawByteString): UnicodeString;
var
i : SizeInt;
- hs : UnicodeString;
chars: array of widechar;
begin
result:='';
if s='' then
exit;
- SetLength(chars,length(s));
- i:=Utf8ToUnicode(pwidechar(chars),length(hs)+1,pchar(s),length(s));
+ SetLength(chars,length(s)+1);
+ i:=Utf8ToUnicode(pwidechar(chars),length(s)+1,pchar(s),length(s));
if i>0 then
- begin
- result:=JLString.Create(chars,0,i);
- end;
+ result:=JLString.Create(chars,0,i-1);
end;