diff options
author | Brian P. Hinz <bphinz@users.sf.net> | 2015-03-02 20:03:42 -0500 |
---|---|---|
committer | Brian P. Hinz <bphinz@users.sf.net> | 2015-03-02 20:24:19 -0500 |
commit | ea4b642874cbb94587906f36f5a2230df23f7ede (patch) | |
tree | 562fcc1353254262841f3e12f721790199670c6e /java/com/tigervnc | |
parent | b33ff746b4b724e3c6594d106642bfaf6412ba6c (diff) | |
download | tigervnc-ea4b642874cbb94587906f36f5a2230df23f7ede.tar.gz tigervnc-ea4b642874cbb94587906f36f5a2230df23f7ede.zip |
Decode serverCutText to ISO-8859-1
Java viewer was incorrectly attempting to decode incoming clipboard updates to UTF-8 instead of Latin-1.
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() |