diff options
Diffstat (limited to 'java/com/tigervnc')
-rw-r--r-- | java/com/tigervnc/rfb/CMsgReader.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/java/com/tigervnc/rfb/CMsgReader.java b/java/com/tigervnc/rfb/CMsgReader.java index 71045f38..a93324ca 100644 --- a/java/com/tigervnc/rfb/CMsgReader.java +++ b/java/com/tigervnc/rfb/CMsgReader.java @@ -23,6 +23,9 @@ package com.tigervnc.rfb; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; import com.tigervnc.rdr.*; abstract public class CMsgReader { @@ -64,13 +67,9 @@ abstract public class CMsgReader { } byte[] buf = new byte[len]; is.readBytes(buf, 0, len); - String str = new String(); - try { - str = new String(buf,"UTF8"); - } catch(java.io.UnsupportedEncodingException e) { - e.printStackTrace(); - } - handler.serverCutText(str, len); + Charset latin1 = Charset.forName("ISO-8859-1"); + CharBuffer chars = latin1.decode(ByteBuffer.wrap(buf)); + handler.serverCutText(chars.toString(), len); } protected void readFramebufferUpdateStart() |