Mark ,
Sorry for nagging you )-; but this is exacly what I did :
//THE CLIENT:
import java.io.*;
import java.net.*;
public class HttpClientHebrew5Test {
public static void main(String[] args) {
try {
String host = "127.0.0.1";
String port = "8083";
String line = null;
BufferedReader bri = new BufferedReader(new
InputStreamReader(new FileInputStream("send"),"Cp1255"));
line = bri.readLine(); // read just one line from hebrew
text
String data = "name=" + URLEncoder.encode(line,
"Cp1255");
URL test = new
URL("http://"+host+":"+port+"/userprofiles/hebrew5test");
URLConnection req = test.openConnection();
req.setDoOutput(true);
req.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded; charset=windows-1255");
req.setRequestProperty("Content-Length",
Integer.toString(data.length()));
OutputStream out = req.getOutputStream();
out.write(data.getBytes("Cp1255"));
out.close();
InputStream in = req.getInputStream();
BufferedReader br = new BufferedReader(new
InputStreamReader(in,"Cp1255"));
File f = new File("received.xml");
FileWriter fw = new FileWriter(f);
while ((line = br.readLine()) != null) {
System.out.println(line);
fw.write(line);
}
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
//THE SERVER
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.io.PrintWriter;
public class Hebrew5test extends HttpServlet {
public Hebrew5test(){
super();
}
public void doPost(HttpServletRequest request,
HttpServletResponse
response)
throws ServletException,
IOException {
doGet(request, response);
}
public void doGet(HttpServletRequest request,
HttpServletResponse
response)
throws ServletException,
IOException {
request.setCharacterEncoding("Cp1255");
response.setContentType("text/html;
charset=windows-1255");
PrintWriter out = response.getWriter();
String name = request.getParameter("name");
System.out.println(name);
out.println(name);
}
}
The result is that i get a file received.xml with "????" which are four
0x3F.
The "send" file is "yair" in hebrew , windows -1255 encoded - which is
0xE9 0xE0 0xE9 0xF8
I use Tomcat5. and I have my server.xml configured with
<Connector URIEncoding="windows-1255" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" port="8083"
redirectPort="8443" useBodyEncodingForURI="true">
what else can it be ?
Regards,
Yair
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]