RE: a simple test to charset

2001-01-05 Thread G.Nagarajan

Hi,

if you create a html file and submit the form to the servlet, the char will
be displayed

like







or you have to encode the special character.

I tried it in IE + tomcat 3.2 + jdk 1.3 on nt.

Regards,
Nagaraj

-Original Message-
From: André Alves [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 04, 2001 9:06 PM
To: [EMAIL PROTECTED]
Subject: a simple test to charset


I, made the following test:
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldExample extends HttpServlet
{
  public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException
  {
String strName = request.getParameter("name");
response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("start");
out.println("");
out.println("Name = "+strName);
out.println("");
out.println("end");
out.println("");
out.println("");
  }
}

And I invoke this servlet with the url:
http://my_ip/servlet/HelloWorldExample?name=André

The html responde is:

start
Name: Andr
end

Tomcat did not catch special caracter "é".

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

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


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




RE: a simple test to charset

2001-01-04 Thread Kitching Simon

Very interesting - a concrete example is always more interesting
to investigate than an abstract bug!

So I gave your code a try and it worked fine on my system!
I can't imagine what might be making it run for me but not run for you..

Just a by-the-way: I think you should also be setting
the charset attribute of the content type for safety,
but I have to admit I don't either, and accents have
always worked fine for me.

How I run it (ie how it works fine):
* tomcat 3.2.1 on HPUX
* Microsoft IE4 as the browser
* I set up a specific servlet-mapping to run the HelloWorldExample,
  rather than running it through the invoker servlet. (I had deliberately
  turned off the invoker servlet a long time ago; funny enough, I
  can't seem to get it running again now...)


You might want to try using a url-encoded version of your url, ie
not
http://my_ip/servlet/HelloWorldExample?name=André
but
http://my_ip/servlet/HelloWorldExample?name=Andr%E9

Actually, though, both of these work OK for me anyway.

I'll have a think about this tomorrow (home time now) -
good luck tracking this down...

Simon
> -Original Message-
> From: André Alves [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, January 04, 2001 9:06 PM
> To:   [EMAIL PROTECTED]
> Subject:  a simple test to charset
> 
> I, made the following test:
> import java.io.*;
> import java.text.*;
> import java.util.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> 
> public class HelloWorldExample extends HttpServlet
> {
>   public void doGet(HttpServletRequest request, HttpServletResponse
> response) throws IOException, ServletException
>   {
> String strName = request.getParameter("name"); 
> response.setContentType("text/html");
> PrintWriter out = response.getWriter();
> 
> out.println("");
> out.println("");
> out.println("");
> out.println("");
> out.println("");
> out.println("start");
> out.println("");
> out.println("Name = "+strName);
> out.println("");
> out.println("end");
> out.println("");
> out.println("");
>   }
> }
> 
> And I invoke this servlet with the url:
> http://my_ip/servlet/HelloWorldExample?name=André
> 
> The html responde is:
> 
> start
> Name: Andr
> end
> 
> Tomcat did not catch special caracter "é". 
> 
> __
> Do You Yahoo!?
> Yahoo! Photos - Share your holiday photos online!
> http://photos.yahoo.com/
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

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




a simple test to charset

2001-01-04 Thread André Alves

I, made the following test:
import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorldExample extends HttpServlet
{
  public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException
  {
String strName = request.getParameter("name"); 
response.setContentType("text/html");
PrintWriter out = response.getWriter();

out.println("");
out.println("");
out.println("");
out.println("");
out.println("");
out.println("start");
out.println("");
out.println("Name = "+strName);
out.println("");
out.println("end");
out.println("");
out.println("");
  }
}

And I invoke this servlet with the url:
http://my_ip/servlet/HelloWorldExample?name=André

The html responde is:

start
Name: Andr
end

Tomcat did not catch special caracter "é". 

__
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

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