import java.io.BufferedReader;
import java.io.FileReader;
import java.io.UnsupportedEncodingException;

public class CharacterTest {
	public static String readFile(String fileName) {
		try {
			BufferedReader fr = new BufferedReader(new FileReader(fileName));
			StringBuffer out = new StringBuffer();
			String thisLine = new String();
			while ((thisLine = fr.readLine()) != null) {
				out.append(thisLine);
			}
			fr.close();
			return out.toString();
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	public static String getString() {
		String out = readFile("E:\\wangxining\\projects\\jsptutorial\\eclipse\\workspace\\HelloWorldProject\\HelloWorldProject\\JavaSource\\text.txt");
		try {
			out = new String(out.getBytes("Gb18030"), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return out;
	}

	public static void main(String args[]) {
		String out = readFile("E:\\wangxining\\projects\\jsptutorial\\eclipse\\workspace\\HelloWorldProject\\HelloWorldProject\\JavaSource\\text.txt");
		try {
			out = new String(out.getBytes("Gb18030"), "utf-8");
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("[" + out + "]");
	}
}
