Re: struts response character encoding.

2004-07-19 Thread Olve Sæther Hansen
sn, 18.07.2004 kl. 22.23 skrev Jason Lea:
 Olve Sther Hansen wrote:
 
 Now I am saying false things. I thought my baseLayout.jsp had this
 entry.. It didn't.
 
 So it is enough specifying 
 %@ page contentType=text/html; charset=UTF-8%
 in the base tiles file if that architecture is used.
 
   
 
 I think it that should work.
 
 But I think I ran into a problem when pre-compiling the JSP pages when 
 using the 2.3 spec.  If you don't pre-compile I think it should be ok.  
 If you do pre-compile, each JSP is passed to the compiler and the 
 compiler does not know the encoding, so it uses the default.  This is 
 why I ended up adding it to all pages.

I ended up using the directive for all jsp's containing non-ascii utf-8
characters.. 

Most messages are retrieved through the resource properties, but when I
am lazy, I write things directly in the jsp.

Thanks for the help!

-- 
Olve Sther Hansen [EMAIL PROTECTED]
Systems developer - National english reading tests
Intermedia/Aksis - Unifob 
http://www.intermedia.uib.no



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



Re: struts response character encoding.

2004-07-19 Thread Emmanouil Batsis
There this system property you can set but I can't remember it, it's 
used as the encoding to use when reading files...

Anyway, I always edit my  .jsp and .properties using UTF-8, then pass 
them through the native2ascii ant task during my build. It's just a 
wrapper for the same-named JDK binary; you can use that directly if you 
dont use Ant. Works great.

hth,
Manos
Olve Sther Hansen wrote:
I have some problems using struts/tiles and UTF-8 characters embedded in
an jsp page.
How can I make struts/tiles respect the system default encoding, and not
use iso-8859-1 for all jsp pages? 

This problem occurs in tomcat 4.1.29, 5.0.19 and 5.0.27.
I have a struts version bundled with Appfuse, all I know is that it is
from 2003-12.02 (that is 2. december).
It seems like struts is hard-coding the response encoding to be
ISO-8859-1, although the response-encoding is set to be UTF-8 for all
requests..
In a struts-action I execute this code:
log.debug(res encoding:  +response.getCharacterEncoding());
log.debug(req encoding:  +request.getCharacterEncoding());
resulting in:
res encoding: ISO-8859-1
req encoding: UTF-8
I use the SpringFramework characterEncodingFilter to force utf-8.
My web-browser reports the page to be encoded in utf-8.
If I use iconv (a Linux program for converting files from one encoding
to another) to convert a file containing utf-8 characters (norwegian
characters   ) to iso-8859-1, the pages displays correctly.
My web-browser still reports the page as being encoded in utf-8. 

If I write the same Norwegian letters in a jsp page outside of
struts/tiles control, the page displays without problems..
So, is there a way to make struts/tiles respect the system default
encoding, and not use iso-8859-1 for all jsp pages? 

Hope someone can help me solve this problem, I have looked through most
email archives I can find without any solution.
 


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


Re: struts response character encoding.

2004-07-19 Thread Olve Sæther Hansen
man, 19.07.2004 kl. 14.58 skrev Emmanouil Batsis:
 There this system property you can set but I can't remember it, it's 
 used as the encoding to use when reading files...
 
 Anyway, I always edit my  .jsp and .properties using UTF-8, then pass 
 them through the native2ascii ant task during my build. It's just a 
 wrapper for the same-named JDK binary; you can use that directly if you 
 dont use Ant. Works great.

Yes, I know. I am using that one for my resource files. But In my
opinion, it should not be necessary to convert the encoding for that
file(s) either. Somewhere behind the scenes there is a
java.util.Properties class used, and that class assumes iso-8859-1. 
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html#encoding

Encodings should be as transparent as possible, not the assumptions of
some developers.

Since I am developing and deploying on utf-8 encoding platforms,
everything should be smooth, but it is not.

I discovered that Struts use iso-8859-1 as default (same as
java.util.Properties), and in order to override this setting I have to
put a % @page ... % directive on every jsp.

Ant can really native2ascii'ify all of this, but what about the one who
have to administer this mess?

When I am on my way to the next job, and they find a misspelling or they
have to change some stuff in either the jsp or a resource file lokking
like this (arbitrary Norwegian text):
Sp\u00f8rsm\u00e5lsgruppen slettet, tilh\u00f8rende sp\u00f8rms\u00e5l
eksisterer fortsatt

I wish encodings were as simple as they could be (everyone used utf-8)
;-)


-- 
Olve Sther Hansen [EMAIL PROTECTED]
Intermedia/Aksis - Unifob AS


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



Re: struts response character encoding.

2004-07-18 Thread Olve Sæther Hansen
Thanks a lot.

I was under the misconception that it was sufficient to encode the
baseLayout.jsp I use in tiles with this line. Now I understand that
tiles has to knwo the encoding of every file in which it has control
over.. 

I guess the other solution also works well, but I use xdoclet, and hence
Servlet 2.3 spec. 

Again, thanks for the prompt and to the point correct answer.

-- 
Olve

sn, 18.07.2004 kl. 02.46 skrev Jason Lea:
 iso-8859-1 is the default page encoding for web pages.  To use anything else you 
 need to tell the webserver.
 
 
 Use this at the top of every jsp page:
 
 %@ page contentType=text/html; charset=UTF-8%
 
 Or for Tomcat 5 you can use Servelt 2.4/JSP2.0 spec and set the page 
 encoding in the web.xml
 
 jsp-config
 jsp-property-group
 url-pattern*.jsp/url-pattern
 page-encodingUTF-8/page-encoding
 /jsp-property-group
 /jsp-config
 
 
 Olve Sther Hansen wrote:
 
 I have some problems using struts/tiles and UTF-8 characters embedded in
 an jsp page.
 
 How can I make struts/tiles respect the system default encoding, and not
 use iso-8859-1 for all jsp pages? 
 
 This problem occurs in tomcat 4.1.29, 5.0.19 and 5.0.27.
 I have a struts version bundled with Appfuse, all I know is that it is
 from 2003-12.02 (that is 2. december).
 
 It seems like struts is hard-coding the response encoding to be
 ISO-8859-1, although the response-encoding is set to be UTF-8 for all
 requests..
 
 In a struts-action I execute this code:
 log.debug(res encoding:  +response.getCharacterEncoding());
 log.debug(req encoding:  +request.getCharacterEncoding());
 
 resulting in:
 res encoding: ISO-8859-1
 req encoding: UTF-8
 
 I use the SpringFramework characterEncodingFilter to force utf-8.
 My web-browser reports the page to be encoded in utf-8.
 
 If I use iconv (a Linux program for converting files from one encoding
 to another) to convert a file containing utf-8 characters (norwegian
 characters   ) to iso-8859-1, the pages displays correctly.
 
 My web-browser still reports the page as being encoded in utf-8. 
 
 If I write the same Norwegian letters in a jsp page outside of
 struts/tiles control, the page displays without problems..
 
 So, is there a way to make struts/tiles respect the system default
 encoding, and not use iso-8859-1 for all jsp pages? 
 
 Hope someone can help me solve this problem, I have looked through most
 email archives I can find without any solution.
 
   
 
-- 
Olve Sther Hansen [EMAIL PROTECTED]
Intermedia/Aksis - Unifob AS


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



Re: struts response character encoding.

2004-07-18 Thread Olve Sæther Hansen
Now I am saying false things. I thought my baseLayout.jsp had this
entry.. It didn't.

So it is enough specifying 
%@ page contentType=text/html; charset=UTF-8%
in the base tiles file if that architecture is used.

-- 
Olve Sther Hansen [EMAIL PROTECTED]
Intermedia/Aksis - Unifob AS


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



Re: struts response character encoding.

2004-07-18 Thread Jason Lea
Olve Sther Hansen wrote:
Now I am saying false things. I thought my baseLayout.jsp had this
entry.. It didn't.
So it is enough specifying 
%@ page contentType=text/html; charset=UTF-8%
in the base tiles file if that architecture is used.

 

I think it that should work.
But I think I ran into a problem when pre-compiling the JSP pages when 
using the 2.3 spec.  If you don't pre-compile I think it should be ok.  
If you do pre-compile, each JSP is passed to the compiler and the 
compiler does not know the encoding, so it uses the default.  This is 
why I ended up adding it to all pages.

--
Jason Lea

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


struts response character encoding.

2004-07-17 Thread Olve Sæther Hansen
I have some problems using struts/tiles and UTF-8 characters embedded in
an jsp page.

How can I make struts/tiles respect the system default encoding, and not
use iso-8859-1 for all jsp pages? 

This problem occurs in tomcat 4.1.29, 5.0.19 and 5.0.27.
I have a struts version bundled with Appfuse, all I know is that it is
from 2003-12.02 (that is 2. december).

It seems like struts is hard-coding the response encoding to be
ISO-8859-1, although the response-encoding is set to be UTF-8 for all
requests..

In a struts-action I execute this code:
log.debug(res encoding:  +response.getCharacterEncoding());
log.debug(req encoding:  +request.getCharacterEncoding());

resulting in:
res encoding: ISO-8859-1
req encoding: UTF-8

I use the SpringFramework characterEncodingFilter to force utf-8.
My web-browser reports the page to be encoded in utf-8.

If I use iconv (a Linux program for converting files from one encoding
to another) to convert a file containing utf-8 characters (norwegian
characters   ) to iso-8859-1, the pages displays correctly.

My web-browser still reports the page as being encoded in utf-8. 

If I write the same Norwegian letters in a jsp page outside of
struts/tiles control, the page displays without problems..

So, is there a way to make struts/tiles respect the system default
encoding, and not use iso-8859-1 for all jsp pages? 

Hope someone can help me solve this problem, I have looked through most
email archives I can find without any solution.

-- 
Olve Sther Hansen [EMAIL PROTECTED]
Intermedia/Aksis - Unifob AS


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



Re: struts response character encoding.

2004-07-17 Thread Jason Lea
iso-8859-1 is the default page encoding for web pages.  To use anything else you need 
to tell the webserver.
Use this at the top of every jsp page:
%@ page contentType=text/html; charset=UTF-8%
Or for Tomcat 5 you can use Servelt 2.4/JSP2.0 spec and set the page 
encoding in the web.xml

   jsp-config
   jsp-property-group
   url-pattern*.jsp/url-pattern
   page-encodingUTF-8/page-encoding
   /jsp-property-group
   /jsp-config
Olve Sther Hansen wrote:
I have some problems using struts/tiles and UTF-8 characters embedded in
an jsp page.
How can I make struts/tiles respect the system default encoding, and not
use iso-8859-1 for all jsp pages? 

This problem occurs in tomcat 4.1.29, 5.0.19 and 5.0.27.
I have a struts version bundled with Appfuse, all I know is that it is
from 2003-12.02 (that is 2. december).
It seems like struts is hard-coding the response encoding to be
ISO-8859-1, although the response-encoding is set to be UTF-8 for all
requests..
In a struts-action I execute this code:
log.debug(res encoding:  +response.getCharacterEncoding());
log.debug(req encoding:  +request.getCharacterEncoding());
resulting in:
res encoding: ISO-8859-1
req encoding: UTF-8
I use the SpringFramework characterEncodingFilter to force utf-8.
My web-browser reports the page to be encoded in utf-8.
If I use iconv (a Linux program for converting files from one encoding
to another) to convert a file containing utf-8 characters (norwegian
characters   ) to iso-8859-1, the pages displays correctly.
My web-browser still reports the page as being encoded in utf-8. 

If I write the same Norwegian letters in a jsp page outside of
struts/tiles control, the page displays without problems..
So, is there a way to make struts/tiles respect the system default
encoding, and not use iso-8859-1 for all jsp pages? 

Hope someone can help me solve this problem, I have looked through most
email archives I can find without any solution.
 


--
Jason Lea

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