altoslib: Use existing unicode Charset in AltosLink
authorKeith Packard <keithp@keithp.com>
Mon, 3 Feb 2014 08:26:42 +0000 (00:26 -0800)
committerKeith Packard <keithp@keithp.com>
Mon, 3 Feb 2014 08:31:57 +0000 (00:31 -0800)
Instead of making AltosLink look up the unicode charset, just provide
it directly.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosLink.java

index 8346d281f1e2a0be012f2b69fcef15fa302e04e8..97fa70625ce8d90aa5e1e84eb1f1b01b7c4ba8e2 100644 (file)
@@ -251,13 +251,7 @@ public abstract class AltosLink implements Runnable {
 
        public void add_bytes(byte[] bytes, int len) throws InterruptedException {
                String  line;
-               try {
-                       line = new String(bytes, 0, len, "UTF-8");
-               } catch (UnsupportedEncodingException ue) {
-                       line = "";
-                       for (int i = 0; i < len; i++)
-                               line = line + bytes[i];
-               }
+               line = new String(bytes, 0, len, AltosLib.unicode_set);
                if (debug)
                        System.out.printf("\t\t\t\t\t%s\n", line);
                add_string(line);