// Convert data when writing data to the database
Public String gb2312_iso8859 (string write)
{
// Declare the character set
System. Text. Encoding iso8859, gb2312;
// Iso8859
Iso8859 = system. Text. encoding. getencoding ("iso8859-1 ");
// 2312 GB
Gb2312 = system. Text. encoding. getencoding ("gb2312 ");
Byte [] GB;
GB = gb2312.getbytes (write );
// Return the converted characters
Return iso8859.getstring (GB );
}
// Convert data when reading data
Public String iso8859_gb2312 (string read)
{
// Declare the character set
System. Text. Encoding iso8859, gb2312;
// Iso8859
Iso8859 = system. Text. encoding. getencoding ("iso8859-1 ");
// 2312 GB
Gb2312 = system. Text. encoding. getencoding ("gb2312 ");
Byte [] ISO;
ISO = iso8859.getbytes (read );
// Return the converted characters
Return gb2312.getstring (ISO );
}
// Batch Data Conversion
// Read the content of dataset to the XML file and then output it.
Public dataset iso8859_gb2312 (Dataset DS)
{
String XML;
Xml = Ds. getxml ();
DS. Clear ();
// Declare the character set
System. Text. Encoding iso8859, gb2312;
// Iso8859
Iso8859 = system. Text. encoding. getencoding ("iso8859-1 ");
// 2312 GB
Gb2312 = system. Text. encoding. getencoding ("gb2312 ");
Byte [] Bt;
Bt = iso8859.getbytes (XML );
Xml = gb2312.getstring (BT );
DS. readxml (new system. Io. stringreader (XML ));
Return Ds;
}