public static String getCharset(String url) {
		String charset ="";
		BufferedReader br =null;
		try {
			br =new BufferedReader(new InputStreamReader(new URL(url).openStream()));
			String line;
			int lineNum =0;
			//<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
			Pattern pattern =Pattern.compile("<meta.*charset\\s*=\"?([a-zA-Z0-9-]+)\"\\s*/?\\s*>", Pattern.CASE_INSENSITIVE);
			while ((line =br.readLine())!=null && lineNum<128) {
				System.out.println(line);
				Matcher matcher =pattern.matcher(line);
				if (matcher.find()) {
					charset =matcher.group(1);
					break;
				}
				lineNum++;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			//if ("".equals(charset.trim())) charset ="utf8";
			try {
				if (br!=null) br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
		return charset;
	}