On mÃn, 2004-09-20 at 19:25 +0200, Noa Resare wrote:
> Is running a program like the one attached below in Sun's java an ok way
> of gathering the information needed to implement the "historical
> charset" functionality?
MEEP. Forgot to attach. Here goes.
/noa
--
And the lions ate the christians and the christians burned the witches,
and even I am out of explanations -- Ola Salo
gpg fingerprint: F3C4 AC90 B885 FE15 344B 4D05 220B 7662 A190 6F09
import java.util.*;
import java.io.*;
import java.nio.charset.Charset;
public class HistoricalCharsetChecker
{
public static void main(String[] args)
throws Exception
{
Map charsetMap = Charset.availableCharsets();
Iterator charsets = charsetMap.keySet().iterator();
while (charsets.hasNext())
{
String charsetName = (String)charsets.next();
String historicalName = getHistoricalName(charsetName);
if (!historicalName.equals(charsetName))
System.out.println(charsetName + ": " + historicalName);
}
}
private static OutputStream os = new ByteArrayOutputStream();
private static String getHistoricalName(String charsetName)
throws Exception
{
OutputStreamWriter osw = new OutputStreamWriter(os, charsetName);
return osw.getEncoding();
}
}
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/classpath