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

  1. Stefan Poehn

    Stefan Poehn Guest


    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?

    Stefan Poehn, Jul 26, 2004
    1. Advertisements

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. Bill Lattery via JavaKB.com


    Bill Lattery via JavaKB.com, Nov 19, 2004, in forum: Java
    Boudewijn Dijkstra
    Nov 23, 2004