Posted By:
James_Bayer
Posted On:
Thursday, January 23, 2003 02:03 PM
if possible, make sure the contents of the myString variable are correct by checking them out. the easiest way to do that quickly is to launch a awt or swing app to see if it renders the chars correct...don't forget to add this to you imports:
import javax.swing.*;
JFrame frame = new JFrame( "Character Test" );
frame.setSize( 400, 400 );
frame.getContentPane().add( new JLabel( myString ) );
frame.setVisible( true );
if that works, then you know that the problem is with the email portion of your app and it may be as simple as modifying the "text/html;charset=gb2312" string. if that doesn't work, then you may have to use other methods to read the text properly in the first place.
byte[] bytes = myString.getBytes(); //or read the bytes from the file into the bytes array here
String strEncoding = "GB2312"; //this may not be the right string, verify that
String strString = new String( bytes, strEncoding );
now try it in the awt/swing code again and see if you have it and go from there.