중국어 문자 인코딩 정상 디버깅 코드 보이기

문자가 부호화되었을 때, 몇 가지 문자를 통해 볼 수 있다. 그런 문자를 사용하면 정상적인 문자를 표시할 수 있다.
그 인코딩을 통해 문자를 정상적인 중국어 문자로 표시할 수 있는지 테스트할 수 있다.


	public static void testCode(String text)
	{
		String[] srcCode={"gbk","gb2312","utf-8","iso8859-1","latin1"};
		String text1;
		try
		{   
		for(int i=0;i<srcCode.length;i++)
		{
			text1=new String(text.getBytes(),srcCode[i]);
			logger.info(srcCode[i]+":"+text1);
		}
		
		for(int i=0;i<srcCode.length;i++)
		{
			for(int j=0;j<srcCode.length;j++)
			{
				text1=new String(text.getBytes(srcCode[i]),srcCode[j]);
				logger.info(srcCode[i]+","+srcCode[j]+":"+text1);
			}
		}
		
		text1=java.net.URLDecoder.decode(text);
		logger.info(text1);
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

좋은 웹페이지 즐겨찾기