UnsupportedEncodingException

Discussion in 'Java' started by Stefan Poehn, Jul 26, 2004.

  1. Stefan Poehn

    Stefan Poehn Guest

    Hi

    I have found a strange behavior in my program. Since Thursday I get an
    UnsupportedEncodingException in a call
    to new String(byte[] buf,String encoding); when I set encoding to "Cp850"
    (DOS Latin1). It worked before with the same java code, the same classpath,
    the same jdk directory and the same environment variables.

    I assume the methods that solve the encoding use the classes
    $JRE\lib\charsets.jar. What is really strange is that I can use the classes
    in charsets.jar, e.g. sun.io.ByteToCharCp850 without changing the classpath
    (and then encoding works perfect). Why does the constructor String(byte[]
    buf,String encoding); not use the ByteToCharCp850 class?

    What should I do when java.nio.charset.Charset.availableCharsets does not
    return Cp850, and I need exactly this codepage for my program to work?

    Thanks
    Stefan
    Stefan Poehn, Jul 26, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon A. Cruz

    Re: UnsupportedEncodingException

    Jon A. Cruz, Jul 25, 2003, in forum: Java
    Replies:
    0
    Views:
    1,286
    Jon A. Cruz
    Jul 25, 2003
  2. Bill Lattery via JavaKB.com

    UnsupportedEncodingException

    Bill Lattery via JavaKB.com, Nov 19, 2004, in forum: Java
    Replies:
    10
    Views:
    10,526
    Boudewijn Dijkstra
    Nov 23, 2004
Loading...

Share This Page