/* Copyright 2004 Sun Microsystems, Inc. All rights reserved. You may not modify, use, reproduce, or distribute this software except in compliance with the terms of the License at:
http://adventurebuilder.dev.java.net/LICENSE.txt
$Id: I18nUtil.java,v 1.2 2004/05/26 00:07:34 inder Exp $ */
import java.io.ByteArrayOutputStream;
/**
* This utility class for internationalization. This class provides a central
* location to do specialized formatting in both a default and a locale specfic
* manner.
*/
public class Main {
/**
* Converts a String SJIS or JIS URL encoded hex encoding to a Unicode String
*
*/
public static String convertJISEncoding(String target) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
if (target == null)
return null;
String paramString = target.trim();
for (int loop = 0; loop < paramString.length(); loop++) {
int i = (int) paramString.charAt(loop);
bos.write(i);
}
String convertedString = null;
try {
convertedString = new String(bos.toByteArray(), "JISAutoDetect");
} catch (java.io.UnsupportedEncodingException uex) {
}
return convertedString;
}
}
|