|
First you need to determine what your Oracle character set is. If your Oracle character set does not support Chinese, it will be garbled when displayed later.
The solution in Java:
Transcode Chinese to ISO and save it, and then convert from ISO to GBK when displaying, there will be no problem.
The java method of transcoding is as follows:
public static String ISO2GB (String isoStr)
{
if (isoStr == null)
return null;
String gbStr = "";
try
{
gbStr = new String (isoStr.getBytes ("ISO_8859_1"), "GBK");
}
catch (Exception e)
{
System.out.println (e);
}
return gbStr;
}
public static String GB2ISO (String gbStr)
{
if (gbStr == null)
return null;
String isoStr = "";
try
{
isoStr = new String (gbStr.getBytes ("GBK"), "ISO_8859_1");
}
catch (Exception e)
{
System.out.println (e);
}
return isoStr;
} |
|