Re: default pageEncoding

2002-07-30 Thread Daniel Bruce Lynes

On Monday 22 July 2002 23:26, Dmitry Melekhov wrote:

> Eric Leung wrote:
> > Hi,
> >
> > yes, just like HTML add a line like this:
> > 
> >
> > 
> >
> > character set
> >
> > Eric
>
> I understand.
> But our devepopers are too lazy ;-)
> They don't want to write this line in every jsp...
> Is it possible to configure Tomcat (something else) to set default
> encoding?

Besides that, the meta tag doesn't quite work.

Tomcat outputs:

Content-Type: text/html; charset=iso-8859-1

As one of its standard headers.  So, if you're like us, and you're trying to 
output Simplified Chinese, the Simplified Chinese will still show up as 
garbage characters.  The meta tag only overrode the http response header 
under Mozilla, and only under certain conditions.

To get around this problem, you can change your page directive to be:

<%@page contentType="text/html"%>

Note, how I didn't include the charset as part of the content type.

The default is:

<%@page contentType="text/html; charset=iso-8559-1"%>

So, what you can do is:

<%@page contentType="text/html"%>





This is my ÖÐÎÄ text.


And if you've got lazy programmers, you can always write a perl script to go 
through every page that's already been written and just insert it.  Every 
subsequent page however, will need to be updated manually.  Or, like I 
did...a combination of perl and shell scripts :)  I had the task of updating 
400 JSP files, and there was no damned way I was going to do it manually. :p

If you'd like, you can email me privately, and I'll send you the perl utility 
I used as a base for my scripts, but the shell scripts are heavily site 
dependent.

ttfn

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




Re: AW: default pageEncoding

2002-07-23 Thread Craig R. McClanahan



On Tue, 23 Jul 2002, Dmitry Melekhov wrote:

> Date: Tue, 23 Jul 2002 11:35:27 +0500
> From: Dmitry Melekhov <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: AW: default pageEncoding
>
> Ralph Einfeldt wrote:
> > AFAIK it not possible to set the default encoding by configuration.
>
> :-(
>

JSP 2.0 adds directives that let you do this, so you'll see it in Tomcat 5
eventually.  There is no such facility in any earlier version, though.

> > But you could write a servlet filter that does this.
> >
>
> Could you tell me how?
> As I understand, pageEncoding directive works at compile time
> and it is impossible to do this with filter?
>

You're correct -- pageEncoding tells the JSP compiler what encoding the
source page is in at *compile* time.  Filters won't be able to affect
that.

>
> >
> >>-Ursprungliche Nachricht-
> >>Von: Dmitry Melekhov [mailto:[EMAIL PROTECTED]]
> >>Gesendet: Dienstag, 23. Juli 2002 08:26
> >>An: Tomcat Users List
> >>Betreff: Re: default pageEncoding
> >>
> >>I understand.
> >>But our devepopers are too lazy ;-)

Sounds like time to get some new developers :-).

Or provide a template page (that includes this directive) as a starting
point for creating new pages, and make them use it.

> >>They don't want to write this line in every jsp...
> >>Is it possible to configure Tomcat (something else) to set default
> >
> > encoding?
> >

Craig


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




Re: AW: AW: default pageEncoding

2002-07-23 Thread Dmitry Melekhov

Ralph Einfeldt wrote:
> Sorry, my answer was a bit to fast.
> 
> There is more than one aspect of the encoding:
> 
> - Compiletime
>   This aspect defines which character set is/was used to write the
> source
>   of the page. That's what you can define with the -encoding option of
> javac.
> 
>   I'm not shure, how to specify that for tomcat without the
> pagedirective.
>   (As far as I can see, it's not possible to configure the encoding in
> web.xml)
> 
> - Runtime
>   This aspect defines the default character encoding while reading from
> streams and 
>   writing to streams. This can be controlled by the system property
> file.encoding.
>   I would expect that if you set this attribute, your value is used by
> tomcat to
>   generate and compile the page. (The spec is quite open at that point:
> 'A JSP 
>   container may use some implementation-dependent heuristics and/or
>   structure to determine what the expected character encoding of a JSP
> is...')
>   I haven't tried this.
> 
> - Requesttime
>   This aspect defines which character set shall be used to read the
> request
>   from the client and to write the response to the client. This can be
> controlled
>   by a filter.


Thank you!

I think that javac -encoding is what I need.
You write that you don't know way to set it in web.xml...
But may be this is possible?



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




AW: AW: default pageEncoding

2002-07-23 Thread Ralph Einfeldt

Sorry, my answer was a bit to fast.

There is more than one aspect of the encoding:

- Compiletime
  This aspect defines which character set is/was used to write the
source
  of the page. That's what you can define with the -encoding option of
javac.

  I'm not shure, how to specify that for tomcat without the
pagedirective.
  (As far as I can see, it's not possible to configure the encoding in
web.xml)

- Runtime
  This aspect defines the default character encoding while reading from
streams and 
  writing to streams. This can be controlled by the system property
file.encoding.
  I would expect that if you set this attribute, your value is used by
tomcat to
  generate and compile the page. (The spec is quite open at that point:
'A JSP 
  container may use some implementation-dependent heuristics and/or
  structure to determine what the expected character encoding of a JSP
is...')
  I haven't tried this.

- Requesttime
  This aspect defines which character set shall be used to read the
request
  from the client and to write the response to the client. This can be
controlled
  by a filter.

> -Ursprungliche Nachricht-
> Von: Dmitry Melekhov [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 23. Juli 2002 08:35
> An: Tomcat Users List
> Betreff: Re: AW: default pageEncoding
> 
> Could you tell me how?
> As I understand, pageEncoding directive works at compile time
> and it is impossible to do this with filter?
> 

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




Re: AW: default pageEncoding

2002-07-22 Thread Dmitry Melekhov

Ralph Einfeldt wrote:
> AFAIK it not possible to set the default encoding by configuration.

:-(

> But you could write a servlet filter that does this.
> 

Could you tell me how?
As I understand, pageEncoding directive works at compile time
and it is impossible to do this with filter?


> 
>>-Ursprungliche Nachricht-
>>Von: Dmitry Melekhov [mailto:[EMAIL PROTECTED]]
>>Gesendet: Dienstag, 23. Juli 2002 08:26
>>An: Tomcat Users List
>>Betreff: Re: default pageEncoding
>>
>>I understand.
>>But our devepopers are too lazy ;-)
>>They don't want to write this line in every jsp...
>>Is it possible to configure Tomcat (something else) to set default
> 
> encoding?
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 




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




AW: default pageEncoding

2002-07-22 Thread Ralph Einfeldt

AFAIK it not possible to set the default encoding by configuration.
But you could write a servlet filter that does this.

> -Ursprungliche Nachricht-
> Von: Dmitry Melekhov [mailto:[EMAIL PROTECTED]]
> Gesendet: Dienstag, 23. Juli 2002 08:26
> An: Tomcat Users List
> Betreff: Re: default pageEncoding
> 
> I understand.
> But our devepopers are too lazy ;-)
> They don't want to write this line in every jsp...
> Is it possible to configure Tomcat (something else) to set default
encoding?
> 

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




Re: default pageEncoding

2002-07-22 Thread Dmitry Melekhov

Eric Leung wrote:
> Hi,
> 
> yes, just like HTML add a line like this:
> 
>  
> 
>  
> character set
> 
> Eric
> 

I understand.
But our devepopers are too lazy ;-)
They don't want to write this line in every jsp...
Is it possible to configure Tomcat (something else) to set default encoding?

> 
> 
> 
> Hello!
> 
> Is it possible to set default pageEncoding for jsps?
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 




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




RE: default pageEncoding

2002-07-22 Thread Eric Leung

Hi,

yes, just like HTML add a line like this:

 

 
character set

Eric




Hello!

Is it possible to set default pageEncoding for jsps?


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



default pageEncoding

2002-07-22 Thread Dmitry Melekhov

Hello!

Is it possible to set default pageEncoding for jsps?


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