package com.box.ui;
import java.io.UnsupportedEncodingException;
public class URLEncoder {
public static final String stringToGB2312(String s)
{
try {
byte encode[]=s.getBytes("utf-8");
StringBuffer sb=new StringBuffer();
for(int i=0;i<encode.length;i++)
{
String temp=Integer.toHexString(encode[i]);
sb.append('%');
if(temp.length()==8)
sb.append(temp.substring(6));
else
sb.append(temp);
}
return new String(sb);
}catch (UnsupportedEncodingException e) {
System.out.println("Unknown string. Check again first.");
}
return null;
}
}