No, nothing to do Tomcat. But I know "Cp1255" is not part of the standard
charsets supported by Java platform, so you may out of luck here.

Btw, jdk1.4 recommends StringReader over the deprecated
StringBufferInputStream class.

--------------------- 
java.io
Class StringBufferInputStream

Deprecated. This class does not properly convert characters into bytes. As
of JDK 1.1, the preferred way to create a stream from a string is via the
StringReader class.
---------------------

-Yan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: April 20, 2004 10:46
To: [EMAIL PROTECTED]
Subject: RE: Getting a request in a non English character 


Thanks, 
But I tried and it doesn't work 
Is it because it is in the GET request and not in POST 
Maybe Tomcat don't know how to deal with Charset Cp1255 requests?


-----Original Message-----
From: Yansheng Lin [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 20, 2004 5:17 PM
To: 'Tomcat Users List'
Subject: RE: Getting a request in a non English character 


Hi,

I don't have that book, so I am not sure if there is a new version.  But I
think you can try one of the constructors in the String class.

String value = req.getParameter("param");
String valueInUnicode = new String(value.getBytes("Cp1255"), "UTF8");

-Yan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: April 20, 2004 05:10
To: [EMAIL PROTECTED]
Subject: Getting a request in a non English character 


Hi,
In an attempt to solve a problem of getting a request in a non English
character, and to convert it to Unicode, I use a similar code , (BTW , taken
from O'Reilly's "Java Servlet programing" First edition)


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class MyServlet extends HttpServlet {

public void doGet(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException { try { //set encoding of request and responce
req.setCharacterEncoding("Cp1255"); //for hebrew windows 
res.setCharacterEncoding("Cp1255");
res.setContentType("Text/html; Cp1255");
String value = req.getParameter("param");

// Now convert it from an array of bytes to an array of characters. // Here
we bother to read only the first line. BufferedReader reader = new
BufferedReader( new InputStreamReader(new StringBufferInputStream(value),
"Cp1255")); String valueInUnicode = reader.readLine(); }catch (Exception e)
{ e.printStackTrace(); } } }


this works fine , the only problem is that StringBufferInputStream is
deprecated . is there any other alternative for that ? Thanks in advance 
Yair 
 
 
Yair Fine
Golden-Channels
03 9272791
052 921250
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to