re:Java and UTF

From: Erik Kovach (
Date: Wed Jul 02 1997 - 14:03:32 EDT

Java has the power to manipulate the bytes between dozens of encodings
quite easily (although it took myself and several colleagues a while).
Try this nifty function. It says "read these bytes as encoding
<inEnc> and output the bytes in encoding <outEnc>." Encodings can be
Big5, UTF-8 (the standard one...not the goofy Java one), MacThai, or
whatever is supported by the JDK.

For a list of supported encodings that can be specified for the inEnc
and outEnc paramaters, see:

For more information on the getBytes function and the String constructor,
check out:


public static byte [] convert(byte [] inBytes, String inEnc, String outEnc)
    throws UnsupportedEncodingException
    return new String(inBytes, inEnc).getBytes(outEnc);


This archive was generated by hypermail 2.1.2 : Tue Jul 10 2001 - 17:20:35 EDT