code: private static boolean inEncoding(char ch, String encoding) {
          boolean isInEncoding;
          try {
              char cArray[] = new char[1];
              cArray[0] = ch;
              // Construct a String from the char 
              String s = new String(cArray);
              // Encode the String into a sequence of bytes 
              // using the given, named charset. 
              byte[] bArray = s.getBytes(encoding);
              isInEncoding = inEncoding(ch, bArray);
  
          } catch (Exception e) {
              isInEncoding = false;
              
              // If for some reason the encoding is null, e.g.
              // for a temporary result tree, we should just
              // say that every character is in the encoding.
              if (encoding == null)
              	isInEncoding = true;
          }
          return isInEncoding;
      }
docs: This is heart of the code that determines if a given character
  is in the given encoding. This method is probably expensive,
  and the answer should be cached.
  <p>
  This method is not a public API,
  and should only be used internally within the serializer.
  @param ch the char in question, that is not a high char of
  a high/low surrogate pair.
  @param encoding the Java name of the enocding.
  
  @xsl.usage internal