1 Reply Latest reply on Jun 22, 2006 1:18 AM by veniamin

    UnsupportedEncodingException when converting a String to a b

    membrillo

      Hi, I'm trying to get the byte array representation of a String using the Cp284 charset. When doing this in my local machine from a standalone program I have no problem. But when doing this inside my local JBoss a UnsupportedEncodingException raises.

      Anyone know how can I solve this?

      Thnx

       try {
       buffer = this.value.getBytes("Cp284");
       } catch (UnsupportedEncodingException uee) {
       throw uee;
       }
      


        • 1. Re: UnsupportedEncodingException when converting a String to
          veniamin

          Try your code on JVM your JBoss runs on. Also, run this code to determine what encodings you have at all:

          class Test00 {
           public static final void main (String args[]) {
           java.util.Map charsets = java.nio.charset.Charset.availableCharsets();
           java.nio.charset.Charset cs = null;
           java.util.Iterator oiter = charsets.entrySet().iterator(),
           iiter = null;
           int i;
           while (oiter.hasNext()) {
           cs = (java.nio.charset.Charset) ((java.util.Map.Entry) oiter.next()).getValue();
           System.out.print(cs.name());
           iiter = cs.aliases().iterator();
           i = 0;
           while (iiter.hasNext()) {
           System.out.print(i == 0 ? ": " : ", ");
           System.out.print((String) iiter.next());
           i++;
           }
           System.out.println();
           }
           }
          }