yes i tried
method.addRequestHeader("Content-Type", "charset=iso-8859-1");
but didnt work
when my variable is for example "Bonne ann閑 & ?" and posted to coldfusion page which in turn store into DB if i check my DB i find "Bonne ann?e & ? ? ?"
This is my code i hope it helps
public class HttpPostVariables {
public static int PostVariables(String URL, Hashtable variables)
{
PostMethod method;
int statusCode=-1;
try {
method = new PostMethod( URL );
//Loop thru the variables Hashtable and Construct the Parameter of the Post Method
Enumeration enumaration = variables.keys();
int i=1;
while(enumaration.hasMoreElements())
{
String values = (String) enumaration.nextElement();
method.addParameter(values.toString(),variables.get(values).toString());
i++;
}
//method.setRequestHeader("Content-Type", PostMethod.FORM_URL_ENCODED_CONTENT_TYPE);
HttpClient client = new HttpClient();
// Execute the POST method
statusCode = client.executeMethod( method );
if( statusCode != -1 ) {
String contents = method.getResponseBodyAsString();
method.releaseConnection();
System.out.println( contents );//to debug
}
}
catch( Exception e )
{
e.printStackTrace();
}
return statusCode;
}//End PostVariables methods
}//HttpPostVariables
and this is how i call it
String turl = "http://192.168.0.7/........../mak.cfm";
String infoMessage = "Bonne ann閑 & ?";
Hashtable vars = new Hashtable();
vars.put("info_Message",infoMessage);
PostVariables(turl, vars);