src/share/classes/sun/nio/cs/ext/ISO2022_CN_CNS.java

Print this page

        

@@ -74,10 +74,19 @@
                 Charset cset = Charset.forName("EUC_TW"); // CNS11643
                 ISOEncoder = cset.newEncoder();
             } catch (Exception e) { }
         }
 
+        private byte[] bb = new byte[4];
+        public boolean canEncode(char c) {
+            int n = 0;
+            return (c <= '\u007f' ||
+                    (n = ((EUC_TW.Encoder)ISOEncoder).toEUC(c, bb)) == 2 ||
+                    (n == 4 && bb[0] == SS2 &&
+                     (bb[1] == PLANE2 || bb[1] == PLANE3)));
+        }
+
         /*
          * Since ISO2022-CN-CNS possesses a CharsetEncoder
          * without the corresponding CharsetDecoder half the
          * default replacement check needs to be overridden
          * since the parent class version attempts to