Re: Charsets and RequestDispatcher

2002-10-29 Thread Bill Barker
It is explicitly forbidden for an include to change the headers (including
content-type).  Your servlet needs to do a
response.setContentType("text/html; charset=windows-1253") before doing the
include.

Alternatively, for the servlet below, consider doing a "forward" instead of
an "include".

"Holger Brozio" <[EMAIL PROTECTED]> wrote in message
news:013101c27f34$93bd9f60$111d000a@;rnd.j.ad.intershop.net...
> Hello,
>
> i have made the following observation:
>
> I am using Tomcat 4.1.12 on Windows NT.
>
> If i display the jsp page with charset "windows-1253" by invoking the page
> the direct way,
> the characters are displayed correct.
>
> e.g. http://localhost/jsp/enc_test/ch1253.jsp
>
> After that i wrote a small servlet, which uses the
> RequestDispatcher.include()
> mechanism to dispaly the same page inside of this servlet:
>
> e.g.
>
> public class RequestDispatcherTest extends HttpServlet
> {
> public void doGet(HttpServletRequest request,
>HttpServletResponse response)
> throws IOException, ServletException
> {
> // Acquire request parameters we need
> String incPage = request.getParameter("incpage");
> if (incPage != null)
> {
> RequestDispatcher rd =
> getServletContext().getRequestDispatcher(incPage);
> rd.include(request, response);
> return;
> }
>
> System.out.println("No parameter incpage given!");
> }
> }
>
> I have invoked the execution of the page by:
>
>
http://localhost/servlet/RequestDispatcherTest?incpage=/jsp/enc_test/ch1253.
> jsp
>
> To my surprise, all the characters are now displayed as question marks:
>
> ?? ?
>
> 24 ?? 1997
>
> 8 Mbps ??? ? ??? ??? 1998
>
> ??? ??? ?? ?? ?? ?? ??? ?? ???  2 Mbps,
???
> ??  ??  ???  ?? ??? ??? ??? 4 Mbps
,
> ? FORTHnet A.E. ??? ???  ??? ?? ?? ?? ??? ??? ???
> ? ??? ? ?, ? ??? ??? ?? ??
> ??? ?, ? ? 8 Mbps. ? ?? , 
> ??? ? ??  Internet ??? ??? ??? ?? 
,
> ? ?? ?  ???   ??? ?? ???, ??
> ? ?o FORTHnet ?? ??? ?  ??? ? ? ??? ?.
>
> ? ?? ??? ?? ??? ??  ??? ? ??? ,   ???
> ??? ???  MCI, ??? ???  ??? ? ? ? ???
> ??? ??? ??,  ??? ?? ?
??
> ?? ??. ? ???  ? ??? ?
> ? ???  ??,  ??? ??? ???  ? ???
> ? ??? ??? ?  ??? ??, ? ??? ?? ?? ?? ??
> ?? ??? ??? ? ??? ??? ??? 1998, ? ??? ?? ? ??
> ? ??.
>
> ?: ??? 
>
> : 7295100
>
> FAX: 7258520
> -
>
> My question now is:
> Is this the normal (correct) behaviour or is this a bug?
> Does the servlet spec 2.3 prohibit to change the character set of an
> included page somehow?
>
> Thanks in advance
>
> Holger





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Charsets and RequestDispatcher

2002-10-29 Thread Holger Brozio
Hello,

i have made the following observation:

I am using Tomcat 4.1.12 on Windows NT.

If i display the jsp page with charset "windows-1253" by invoking the page
the direct way,
the characters are displayed correct.

e.g. http://localhost/jsp/enc_test/ch1253.jsp

After that i wrote a small servlet, which uses the
RequestDispatcher.include()
mechanism to dispaly the same page inside of this servlet:

e.g.

public class RequestDispatcherTest extends HttpServlet
{
public void doGet(HttpServletRequest request,
   HttpServletResponse response)
throws IOException, ServletException
{
// Acquire request parameters we need
String incPage = request.getParameter("incpage");
if (incPage != null)
{
RequestDispatcher rd =
getServletContext().getRequestDispatcher(incPage);
rd.include(request, response);
return;
}

System.out.println("No parameter incpage given!");
}
}

I have invoked the execution of the page by:

http://localhost/servlet/RequestDispatcherTest?incpage=/jsp/enc_test/ch1253.
jsp

To my surprise, all the characters are now displayed as question marks:

?? ?

24 ?? 1997

8 Mbps ??? ? ??? ??? 1998

??? ??? ?? ?? ?? ?? ??? ?? ???  2 Mbps, ???
??  ??  ???  ?? ??? ??? ??? 4 Mbps ,
? FORTHnet A.E. ??? ???  ??? ?? ?? ?? ??? ??? ???
? ??? ? ?, ? ??? ??? ?? ??
??? ?, ? ? 8 Mbps. ? ?? , 
??? ? ??  Internet ??? ??? ??? ??  ,
? ?? ?  ???   ??? ?? ???, ??
? ?o FORTHnet ?? ??? ?  ??? ? ? ??? ?.

? ?? ??? ?? ??? ??  ??? ? ??? ,   ???
??? ???  MCI, ??? ???  ??? ? ? ? ???
??? ??? ??,  ??? ?? ? ??
?? ??. ? ???  ? ??? ?
? ???  ??,  ??? ??? ???  ? ???
? ??? ??? ?  ??? ??, ? ??? ?? ?? ?? ??
?? ??? ??? ? ??? ??? ??? 1998, ? ??? ?? ? ??
? ??.

?: ??? 

: 7295100

FAX: 7258520
-

My question now is:
Is this the normal (correct) behaviour or is this a bug?
Does the servlet spec 2.3 prohibit to change the character set of an
included page somehow?

Thanks in advance

Holger


--
To unsubscribe, e-mail:   
For additional commands, e-mail: