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

    UnsupportedEncodingException when converting a String to a b

    Albert Smith Newbie

      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
          Evgeniy Karyakin Newbie

          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();
           }
           }
          }